ArmNN  NotReleased
ProfilingTestUtils.cpp File Reference
#include "ProfilingTestUtils.hpp"
#include "ProfilingUtils.hpp"
#include <armnn/Descriptors.hpp>
#include <LabelsAndEventClasses.hpp>
#include <ProfilingService.hpp>
#include <boost/test/unit_test.hpp>

Go to the source code of this file.

Functions

unsigned int OffsetToNextWord (unsigned int numberOfBytes)
 
void VerifyTimelineLabelBinaryPacket (Optional< ProfilingGuid > guid, const std::string &label, const unsigned char *readableData, unsigned int &offset)
 
void VerifyTimelineEventClassBinaryPacket (ProfilingGuid guid, const unsigned char *readableData, unsigned int &offset)
 
void VerifyTimelineRelationshipBinaryPacket (ProfilingRelationshipType relationshipType, Optional< ProfilingGuid > relationshipGuid, Optional< ProfilingGuid > headGuid, Optional< ProfilingGuid > tailGuid, const unsigned char *readableData, unsigned int &offset)
 
void VerifyTimelineEntityBinaryPacket (Optional< ProfilingGuid > guid, const unsigned char *readableData, unsigned int &offset)
 
void VerifyTimelineEventBinaryPacket (Optional< uint64_t > timestamp, Optional< std::thread::id > threadId, Optional< ProfilingGuid > eventGuid, const unsigned char *readableData, unsigned int &offset)
 
void VerifyPostOptimisationStructureTestImpl (armnn::BackendId backendId)
 

Function Documentation

◆ OffsetToNextWord()

unsigned int OffsetToNextWord ( unsigned int  numberOfBytes)
inline

Definition at line 15 of file ProfilingTestUtils.cpp.

References armnn::profiling::uint32_t_size.

Referenced by VerifyTimelineLabelBinaryPacket().

16 {
17  unsigned int uint32_t_size = sizeof(uint32_t);
18 
19  unsigned int remainder = numberOfBytes % uint32_t_size;
20  if (remainder == 0)
21  {
22  return numberOfBytes;
23  }
24 
25  return numberOfBytes + uint32_t_size - remainder;
26 }

◆ VerifyPostOptimisationStructureTestImpl()

void VerifyPostOptimisationStructureTestImpl ( armnn::BackendId  backendId)

Definition at line 355 of file ProfilingTestUtils.cpp.

References LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS, LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS, LabelsAndEventClasses::BACKENDID_GUID, BOOST_CHECK(), ProfilingService::ConfigureProfilingService(), IOutputSlot::Connect(), LabelsAndEventClasses::CONNECTION_GUID, INetwork::Create(), IRuntime::Create(), DataLink, ExecutionLink, armnn::Float32, BackendId::Get(), IConnectableLayer::GetGuid(), IConnectableLayer::GetInputSlot(), IConnectableLayer::GetOutputSlot(), BufferManager::GetReadableBuffer(), LabelsAndEventClasses::INFERENCE_GUID, ProfilingService::Instance(), LabelLink, Convolution2dDescriptor::m_BiasEnabled, IRuntime::CreationOptions::ExternalProfilingOptions::m_EnableProfiling, Convolution2dDescriptor::m_PadBottom, Convolution2dDescriptor::m_PadLeft, Convolution2dDescriptor::m_PadRight, Convolution2dDescriptor::m_PadTop, IRuntime::CreationOptions::m_ProfilingOptions, Convolution2dDescriptor::m_StrideX, Convolution2dDescriptor::m_StrideY, BufferManager::MarkRead(), LabelsAndEventClasses::NAME_GUID, armnn::Optimize(), options, profilingService, RetentionLink, IOutputSlot::SetTensorInfo(), armnn::Success, LabelsAndEventClasses::TYPE_GUID, VerifyTimelineEntityBinaryPacket(), VerifyTimelineEventBinaryPacket(), VerifyTimelineLabelBinaryPacket(), VerifyTimelineRelationshipBinaryPacket(), and LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID.

Referenced by BOOST_AUTO_TEST_CASE().

356 {
357  using namespace armnn;
358 
359  // Create runtime in which test will run
361  options.m_ProfilingOptions.m_EnableProfiling = true;
363  profilingService.ConfigureProfilingService(options.m_ProfilingOptions, true);
365 
366  // build up the structure of the network
368 
369  // Convolution details
370  TensorInfo inputInfo({ 1, 2, 5, 1 }, DataType::Float32);
371  TensorInfo weightInfo({ 3, 2, 3, 1}, DataType::Float32);
372  TensorInfo biasInfo({ 3 }, DataType::Float32);
373  TensorInfo outputInfo({ 1, 3, 7, 1}, DataType::Float32);
374  std::vector<float> weightsData{
375  1.0f, 0.0f, 0.0f,
376  0.0f, 2.0f, -1.5f,
377 
378  0.0f, 0.0f, 0.0f,
379  0.2f, 0.2f, 0.2f,
380 
381  0.5f, 0.0f, 0.5f,
382  0.0f, -1.0f, 0.0f
383  };
384  ConstTensor weights(weightInfo, weightsData);
385 
386  Optional<ConstTensor> optionalBiases;
387  std::vector<float> biasesData{ 1.0f, 0.0f, 0.0f };
388  ConstTensor biases(biasInfo, biasesData);
389  optionalBiases = Optional<ConstTensor>(biases);
390 
391  // Input layer
392  IConnectableLayer* input = net->AddInputLayer(0, "input");
393 
394  // Convolution2d layer
395  Convolution2dDescriptor conv2dDesc;
396  conv2dDesc.m_StrideX = 1;
397  conv2dDesc.m_StrideY = 1;
398  conv2dDesc.m_PadLeft = 0;
399  conv2dDesc.m_PadRight = 0;
400  conv2dDesc.m_PadTop = 2;
401  conv2dDesc.m_PadBottom = 2;
402  conv2dDesc.m_BiasEnabled = true;
403  IConnectableLayer* conv2d = net->AddConvolution2dLayer(conv2dDesc, weights, optionalBiases);
404 
405  // Activation layer
406  armnn::ActivationDescriptor activationDesc;
407  armnn::IConnectableLayer* const activation = net->AddActivationLayer(activationDesc, "activation");
408 
409  // Output layer
410  IConnectableLayer* output = net->AddOutputLayer(0, "output");
411 
412  input->GetOutputSlot(0).Connect(conv2d->GetInputSlot(0));
413  conv2d->GetOutputSlot(0).Connect(activation->GetInputSlot(0));
414  activation->GetOutputSlot(0).Connect(output->GetInputSlot(0));
415 
416  input->GetOutputSlot(0).SetTensorInfo(inputInfo);
417  conv2d->GetOutputSlot(0).SetTensorInfo(outputInfo);
418  activation->GetOutputSlot(0).SetTensorInfo(outputInfo);
419 
420  // optimize the network
421  std::vector<armnn::BackendId> backends = { backendId };
422  IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
423 
424  ProfilingGuid optNetGuid = optNet->GetGuid();
425 
426  // Load it into the runtime. It should success.
427  armnn::NetworkId netId;
428  BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == Status::Success);
429 
430  profiling::ProfilingServiceRuntimeHelper profilingServiceHelper;
431  profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager();
432  auto readableBuffer = bufferManager.GetReadableBuffer();
433 
434  // Profiling is enable, the post-optimisation structure should be created
435  BOOST_CHECK(readableBuffer != nullptr);
436 
437  unsigned int size = readableBuffer->GetSize();
438  BOOST_CHECK(size == 1980);
439 
440  const unsigned char* readableData = readableBuffer->GetReadableData();
441  BOOST_CHECK(readableData != nullptr);
442 
443  unsigned int offset = 0;
444 
445  // Post-optimisation network
446  // Network entity
447  VerifyTimelineEntityBinaryPacket(optNetGuid, readableData, offset);
448 
449  // Entity - Type relationship
451  EmptyOptional(),
452  optNetGuid,
453  EmptyOptional(),
454  readableData,
455  offset);
456 
457  // Type label relationship
459  EmptyOptional(),
460  EmptyOptional(),
462  readableData,
463  offset);
464 
465  // Input layer
466  // Input layer entity
467  VerifyTimelineEntityBinaryPacket(input->GetGuid(), readableData, offset);
468 
469  // Name Entity
470  VerifyTimelineLabelBinaryPacket(EmptyOptional(), "input", readableData, offset);
471 
472  // Entity - Name relationship
474  EmptyOptional(),
475  input->GetGuid(),
476  EmptyOptional(),
477  readableData,
478  offset);
479 
480  // Name label relationship
482  EmptyOptional(),
483  EmptyOptional(),
485  readableData,
486  offset);
487 
488  // Entity - Type relationship
490  EmptyOptional(),
491  input->GetGuid(),
492  EmptyOptional(),
493  readableData,
494  offset);
495 
496  // Type label relationship
498  EmptyOptional(),
499  EmptyOptional(),
501  readableData,
502  offset);
503 
504  // Network - Input layer relationship
506  EmptyOptional(),
507  optNetGuid,
508  input->GetGuid(),
509  readableData,
510  offset);
511 
512  // Conv2d layer
513  // Conv2d layer entity
514  VerifyTimelineEntityBinaryPacket(conv2d->GetGuid(), readableData, offset);
515 
516  // Name entity
517  VerifyTimelineLabelBinaryPacket(EmptyOptional(), "<Unnamed>", readableData, offset);
518 
519  // Entity - Name relationship
521  EmptyOptional(),
522  conv2d->GetGuid(),
523  EmptyOptional(),
524  readableData,
525  offset);
526 
527  // Name label relationship
529  EmptyOptional(),
530  EmptyOptional(),
532  readableData,
533  offset);
534 
535  // Entity - Type relationship
537  EmptyOptional(),
538  conv2d->GetGuid(),
539  EmptyOptional(),
540  readableData,
541  offset);
542 
543  // Type label relationship
545  EmptyOptional(),
546  EmptyOptional(),
548  readableData,
549  offset);
550 
551  // Network - Conv2d layer relationship
553  EmptyOptional(),
554  optNetGuid,
555  conv2d->GetGuid(),
556  readableData,
557  offset);
558 
559  // Input layer - Conv2d layer relationship
561  EmptyOptional(),
562  input->GetGuid(),
563  conv2d->GetGuid(),
564  readableData,
565  offset);
566 
567  // Entity - Type relationship
569  EmptyOptional(),
570  EmptyOptional(),
572  readableData,
573  offset);
574 
575  // Type label relationship
577  EmptyOptional(),
578  EmptyOptional(),
580  readableData,
581  offset);
582 
583  // Conv2d workload
584  // Conv2d workload entity
585  VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
586 
587  // Entity - Type relationship
589  EmptyOptional(),
590  EmptyOptional(),
591  EmptyOptional(),
592  readableData,
593  offset);
594 
595  // Type label relationship
597  EmptyOptional(),
598  EmptyOptional(),
600  readableData,
601  offset);
602 
603  // BackendId entity
604  VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
605 
606  // Entity - BackendId relationship
608  EmptyOptional(),
609  EmptyOptional(),
610  EmptyOptional(),
611  readableData,
612  offset);
613 
614  // BackendId label relationship
616  EmptyOptional(),
617  EmptyOptional(),
619  readableData,
620  offset);
621 
622  // Conv2d layer - Conv2d workload relationship
624  EmptyOptional(),
625  conv2d->GetGuid(),
626  EmptyOptional(),
627  readableData,
628  offset);
629 
630  // Activation layer
631  // Activation layer entity
632  VerifyTimelineEntityBinaryPacket(activation->GetGuid(), readableData, offset);
633 
634  // Name entity
635  VerifyTimelineLabelBinaryPacket(EmptyOptional(), "activation", readableData, offset);
636 
637  // Entity - Name relationship
639  EmptyOptional(),
640  activation->GetGuid(),
641  EmptyOptional(),
642  readableData,
643  offset);
644 
645  // Name label relationship
647  EmptyOptional(),
648  EmptyOptional(),
650  readableData,
651  offset);
652 
653  // Entity - Type relationship
655  EmptyOptional(),
656  activation->GetGuid(),
657  EmptyOptional(),
658  readableData,
659  offset);
660 
661  // Type label relationship
663  EmptyOptional(),
664  EmptyOptional(),
666  readableData,
667  offset);
668 
669  // Network - Activation layer relationship
671  EmptyOptional(),
672  optNetGuid,
673  activation->GetGuid(),
674  readableData,
675  offset);
676 
677  // Conv2d layer - Activation layer relationship
679  EmptyOptional(),
680  conv2d->GetGuid(),
681  activation->GetGuid(),
682  readableData,
683  offset);
684 
685  // Entity - Type relationship
687  EmptyOptional(),
688  EmptyOptional(),
690  readableData,
691  offset);
692 
693  // Type label relationship
695  EmptyOptional(),
696  EmptyOptional(),
698  readableData,
699  offset);
700 
701  // Activation workload
702  // Activation workload entity
703  VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
704 
705  // Entity - Type relationship
707  EmptyOptional(),
708  EmptyOptional(),
709  EmptyOptional(),
710  readableData,
711  offset);
712 
713  // Type label relationship
715  EmptyOptional(),
716  EmptyOptional(),
718  readableData,
719  offset);
720 
721  // BackendId entity
722  VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
723 
724  // Entity - BackendId relationship
726  EmptyOptional(),
727  EmptyOptional(),
728  EmptyOptional(),
729  readableData,
730  offset);
731 
732  // BackendId label relationship
734  EmptyOptional(),
735  EmptyOptional(),
737  readableData,
738  offset);
739 
740  // Activation layer - Activation workload relationship
742  EmptyOptional(),
743  activation->GetGuid(),
744  EmptyOptional(),
745  readableData,
746  offset);
747 
748  // Output layer
749  // Output layer entity
750  VerifyTimelineEntityBinaryPacket(output->GetGuid(), readableData, offset);
751 
752  // Name entity
753  VerifyTimelineLabelBinaryPacket(EmptyOptional(), "output", readableData, offset);
754 
755  // Entity - Name relationship
757  EmptyOptional(),
758  output->GetGuid(),
759  EmptyOptional(),
760  readableData,
761  offset);
762 
763  // Name label relationship
765  EmptyOptional(),
766  EmptyOptional(),
768  readableData,
769  offset);
770 
771  // Entity - Type relationship
773  EmptyOptional(),
774  output->GetGuid(),
775  EmptyOptional(),
776  readableData,
777  offset);
778 
779  // Type label relationship
781  EmptyOptional(),
782  EmptyOptional(),
784  readableData,
785  offset);
786 
787  // Network - Output layer relationship
789  EmptyOptional(),
790  optNetGuid,
791  output->GetGuid(),
792  readableData,
793  offset);
794 
795  // Activation layer - Output layer relationship
797  EmptyOptional(),
798  activation->GetGuid(),
799  output->GetGuid(),
800  readableData,
801  offset);
802 
803  // Entity - Type relationship
805  EmptyOptional(),
806  EmptyOptional(),
808  readableData,
809  offset);
810 
811  // Type label relationship
813  EmptyOptional(),
814  EmptyOptional(),
816  readableData,
817  offset);
818 
819  bufferManager.MarkRead(readableBuffer);
820 
821  // Creates structures for input & output.
822  std::vector<float> inputData(inputInfo.GetNumElements());
823  std::vector<float> outputData(outputInfo.GetNumElements());
824 
825  InputTensors inputTensors
826  {
827  {0, ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputData.data())}
828  };
829  OutputTensors outputTensors
830  {
831  {0, Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data())}
832  };
833 
834  // Does the inference.
835  runtime->EnqueueWorkload(netId, inputTensors, outputTensors);
836 
837  // Get readable buffer for inference timeline
838  auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
839  BOOST_CHECK(inferenceReadableBuffer != nullptr);
840 
841  // Get readable buffer for output workload
842  auto outputReadableBuffer = bufferManager.GetReadableBuffer();
843  BOOST_CHECK(outputReadableBuffer != nullptr);
844 
845  // Get readable buffer for input workload
846  auto inputReadableBuffer = bufferManager.GetReadableBuffer();
847  BOOST_CHECK(inputReadableBuffer != nullptr);
848 
849  // Validate input workload data
850  size = inputReadableBuffer->GetSize();
851  BOOST_CHECK(size == 252);
852 
853  readableData = inputReadableBuffer->GetReadableData();
854  BOOST_CHECK(readableData != nullptr);
855 
856  offset = 0;
857 
858  // Input workload
859  // Input workload entity
860  VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
861 
862  // Entity - Type relationship
864  EmptyOptional(),
865  EmptyOptional(),
866  EmptyOptional(),
867  readableData,
868  offset);
869 
870  // Type label relationship
872  EmptyOptional(),
873  EmptyOptional(),
875  readableData,
876  offset);
877 
878  // BackendId entity
879  VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
880 
881  // Entity - BackendId relationship
883  EmptyOptional(),
884  EmptyOptional(),
885  EmptyOptional(),
886  readableData,
887  offset);
888 
889  // BackendId label relationship
891  EmptyOptional(),
892  EmptyOptional(),
894  readableData,
895  offset);
896 
897  // Input layer - Input workload relationship
899  EmptyOptional(),
900  input->GetGuid(),
901  EmptyOptional(),
902  readableData,
903  offset);
904 
905  bufferManager.MarkRead(inputReadableBuffer);
906 
907  // Validate output workload data
908  size = outputReadableBuffer->GetSize();
909  BOOST_CHECK(size == 252);
910 
911  readableData = outputReadableBuffer->GetReadableData();
912  BOOST_CHECK(readableData != nullptr);
913 
914  offset = 0;
915 
916  // Output workload
917  // Output workload entity
918  VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
919 
920  // Entity - Type relationship
922  EmptyOptional(),
923  EmptyOptional(),
924  EmptyOptional(),
925  readableData,
926  offset);
927 
928  // Type label relationship
930  EmptyOptional(),
931  EmptyOptional(),
933  readableData,
934  offset);
935 
936  // BackendId entity
937  VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
938 
939  // Entity - BackendId relationship
941  EmptyOptional(),
942  EmptyOptional(),
943  EmptyOptional(),
944  readableData,
945  offset);
946 
947  // BackendId label relationship
949  EmptyOptional(),
950  EmptyOptional(),
952  readableData,
953  offset);
954 
955  // Output layer - Output workload relationship
957  EmptyOptional(),
958  output->GetGuid(),
959  EmptyOptional(),
960  readableData,
961  offset);
962 
963  bufferManager.MarkRead(outputReadableBuffer);
964 
965  // Validate inference data
966  size = inferenceReadableBuffer->GetSize();
967  BOOST_CHECK(size == 2020);
968 
969  readableData = inferenceReadableBuffer->GetReadableData();
970  BOOST_CHECK(readableData != nullptr);
971 
972  offset = 0;
973 
974  // Inference timeline trace
975  // Inference entity
976  VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
977 
978  // Entity - Type relationship
980  EmptyOptional(),
981  EmptyOptional(),
983  readableData,
984  offset);
985 
986  // Type label relationship
988  EmptyOptional(),
989  EmptyOptional(),
991  readableData,
992  offset);
993 
994  // Network - Inference relationship
996  EmptyOptional(),
997  optNetGuid,
998  EmptyOptional(),
999  readableData,
1000  offset);
1001 
1002  // Start Inference life
1003  // Event packet - timeline, threadId, eventGuid
1005 
1006  // Inference - event relationship
1008  EmptyOptional(),
1009  EmptyOptional(),
1010  EmptyOptional(),
1011  readableData,
1012  offset);
1013 
1014  // Event - event class relationship
1016  EmptyOptional(),
1017  EmptyOptional(),
1019  readableData,
1020  offset);
1021 
1022  // Execution
1023  // Input workload execution
1024  // Input workload execution entity
1025  VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1026 
1027  // Entity - Type relationship
1029  EmptyOptional(),
1030  EmptyOptional(),
1032  readableData,
1033  offset);
1034 
1035  // Type label relationship
1037  EmptyOptional(),
1038  EmptyOptional(),
1040  readableData,
1041  offset);
1042 
1043  // Inference - Workload execution relationship
1045  EmptyOptional(),
1046  EmptyOptional(),
1047  EmptyOptional(),
1048  readableData,
1049  offset);
1050 
1051  // Workload - Workload execution relationship
1053  EmptyOptional(),
1054  EmptyOptional(),
1055  EmptyOptional(),
1056  readableData,
1057  offset);
1058 
1059  // Start Input workload execution life
1060  // Event packet - timeline, threadId, eventGuid
1062 
1063  // Input workload execution - event relationship
1065  EmptyOptional(),
1066  EmptyOptional(),
1067  EmptyOptional(),
1068  readableData,
1069  offset);
1070 
1071  // Event - event class relationship
1073  EmptyOptional(),
1074  EmptyOptional(),
1076  readableData,
1077  offset);
1078 
1079  // End of Input workload execution life
1080  // Event packet - timeline, threadId, eventGuid
1082 
1083  // Input workload execution - event relationship
1085  EmptyOptional(),
1086  EmptyOptional(),
1087  EmptyOptional(),
1088  readableData,
1089  offset);
1090 
1091  // Event - event class relationship
1093  EmptyOptional(),
1094  EmptyOptional(),
1096  readableData,
1097  offset);
1098 
1099  // Conv2d workload execution
1100  // Conv2d workload execution entity
1101  VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1102 
1103  // Entity - Type relationship
1105  EmptyOptional(),
1106  EmptyOptional(),
1108  readableData,
1109  offset);
1110 
1111  // Type label relationship
1113  EmptyOptional(),
1114  EmptyOptional(),
1116  readableData,
1117  offset);
1118 
1119  // Inference - Workload execution relationship
1121  EmptyOptional(),
1122  EmptyOptional(),
1123  EmptyOptional(),
1124  readableData,
1125  offset);
1126 
1127  // Workload - Workload execution relationship
1129  EmptyOptional(),
1130  EmptyOptional(),
1131  EmptyOptional(),
1132  readableData,
1133  offset);
1134 
1135  // Start Conv2d workload execution life
1136  // Event packet - timeline, threadId, eventGuid
1138 
1139  // Conv2d workload execution - event relationship
1141  EmptyOptional(),
1142  EmptyOptional(),
1143  EmptyOptional(),
1144  readableData,
1145  offset);
1146 
1147  // Event - event class relationship
1149  EmptyOptional(),
1150  EmptyOptional(),
1152  readableData,
1153  offset);
1154 
1155  // End of Conv2d workload execution life
1156  // Event packet - timeline, threadId, eventGuid
1158 
1159  // Conv2d workload execution - event relationship
1161  EmptyOptional(),
1162  EmptyOptional(),
1163  EmptyOptional(),
1164  readableData,
1165  offset);
1166 
1167  // Event - event class relationship
1169  EmptyOptional(),
1170  EmptyOptional(),
1172  readableData,
1173  offset);
1174 
1175  // Activation workload execution
1176  // Activation workload execution entity
1177  VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1178 
1179  // Entity - Type relationship
1181  EmptyOptional(),
1182  EmptyOptional(),
1184  readableData,
1185  offset);
1186 
1187  // Type label relationship
1189  EmptyOptional(),
1190  EmptyOptional(),
1192  readableData,
1193  offset);
1194 
1195  // Inference - Workload execution relationship
1197  EmptyOptional(),
1198  EmptyOptional(),
1199  EmptyOptional(),
1200  readableData,
1201  offset);
1202 
1203  // Workload - Workload execution relationship
1205  EmptyOptional(),
1206  EmptyOptional(),
1207  EmptyOptional(),
1208  readableData,
1209  offset);
1210 
1211  // Start Activation workload execution life
1212  // Event packet - timeline, threadId, eventGuid
1214 
1215  // Activation workload execution - event relationship
1217  EmptyOptional(),
1218  EmptyOptional(),
1219  EmptyOptional(),
1220  readableData,
1221  offset);
1222 
1223  // Event - event class relationship
1225  EmptyOptional(),
1226  EmptyOptional(),
1228  readableData,
1229  offset);
1230 
1231  // End of Activation workload execution life
1232  // Event packet - timeline, threadId, eventGuid
1234 
1235  // Activation workload execution - event relationship
1237  EmptyOptional(),
1238  EmptyOptional(),
1239  EmptyOptional(),
1240  readableData,
1241  offset);
1242 
1243  // Event - event class relationship
1245  EmptyOptional(),
1246  EmptyOptional(),
1248  readableData,
1249  offset);
1250 
1251  // Output workload execution
1252  // Output workload execution entity
1253  VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
1254 
1255  // Entity - Type relationship
1257  EmptyOptional(),
1258  EmptyOptional(),
1260  readableData,
1261  offset);
1262 
1263  // Type label relationship
1265  EmptyOptional(),
1266  EmptyOptional(),
1268  readableData,
1269  offset);
1270 
1271  // Inference - Workload execution relationship
1273  EmptyOptional(),
1274  EmptyOptional(),
1275  EmptyOptional(),
1276  readableData,
1277  offset);
1278 
1279  // Workload - Workload execution relationship
1281  EmptyOptional(),
1282  EmptyOptional(),
1283  EmptyOptional(),
1284  readableData,
1285  offset);
1286 
1287  // Start Output workload execution life
1288  // Event packet - timeline, threadId, eventGuid
1290 
1291  // Output workload execution - event relationship
1293  EmptyOptional(),
1294  EmptyOptional(),
1295  EmptyOptional(),
1296  readableData,
1297  offset);
1298 
1299  // Event - event class relationship
1301  EmptyOptional(),
1302  EmptyOptional(),
1304  readableData,
1305  offset);
1306 
1307  // End of Normalize workload execution life
1308  // Event packet - timeline, threadId, eventGuid
1310 
1311  // Output workload execution - event relationship
1313  EmptyOptional(),
1314  EmptyOptional(),
1315  EmptyOptional(),
1316  readableData,
1317  offset);
1318 
1319  // Event - event class relationship
1321  EmptyOptional(),
1322  EmptyOptional(),
1324  readableData,
1325  offset);
1326 
1327  // End of Inference life
1328  // Event packet - timeline, threadId, eventGuid
1330 
1331  // Inference - event relationship
1333  EmptyOptional(),
1334  EmptyOptional(),
1335  EmptyOptional(),
1336  readableData,
1337  offset);
1338 
1339  // Event - event class relationship
1341  EmptyOptional(),
1342  EmptyOptional(),
1344  readableData,
1345  offset);
1346 
1347  bufferManager.MarkRead(inferenceReadableBuffer);
1348 }
virtual LayerGuid GetGuid() const =0
Head retains(parents) Tail.
Definition: TimelineModel.h:20
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
uint32_t m_PadRight
Padding right value in the width dimension.
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:199
static ARMNN_DLLEXPORT ProfilingStaticGuid WORKLOAD_EXECUTION_GUID
std::vector< std::pair< LayerBindingId, class Tensor > > OutputTensors
Definition: Tensor.hpp:226
void VerifyTimelineLabelBinaryPacket(Optional< ProfilingGuid > guid, const std::string &label, const unsigned char *readableData, unsigned int &offset)
static ARMNN_DLLEXPORT ProfilingStaticGuid ARMNN_PROFILING_EOL_EVENT_CLASS
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options=OptimizerOptions(), Optional< std::vector< std::string > &> messages=EmptyOptional())
Definition: Network.cpp:807
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:20
static ARMNN_DLLEXPORT ProfilingStaticGuid CONNECTION_GUID
uint32_t m_PadBottom
Padding bottom value in the height dimension.
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
ExternalProfilingOptions m_ProfilingOptions
Definition: IRuntime.hpp:76
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
static ARMNN_DLLEXPORT ProfilingStaticGuid INFERENCE_GUID
static ARMNN_DLLEXPORT ProfilingStaticGuid TYPE_GUID
uint32_t m_PadTop
Padding top value in the height dimension.
uint32_t m_PadLeft
Padding left value in the width dimension.
IPacketBufferPtr GetReadableBuffer() override
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
void VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType relationshipType, Optional< ProfilingGuid > relationshipGuid, Optional< ProfilingGuid > headGuid, Optional< ProfilingGuid > tailGuid, const unsigned char *readableData, unsigned int &offset)
void VerifyTimelineEventBinaryPacket(Optional< uint64_t > timestamp, Optional< std::thread::id > threadId, Optional< ProfilingGuid > eventGuid, const unsigned char *readableData, unsigned int &offset)
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:191
static ARMNN_DLLEXPORT ProfilingStaticGuid BACKENDID_GUID
Head execution start depends on Tail execution completion.
Definition: TimelineModel.h:21
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
Definition: Tensor.hpp:225
static INetworkPtr Create()
Definition: Network.cpp:48
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:85
bool m_BiasEnabled
Enable/disable bias.
static ProfilingService & Instance()
static IRuntimePtr Create(const CreationOptions &options)
Definition: Runtime.cpp:32
Head uses data of Tail.
Definition: TimelineModel.h:22
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:61
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:544
void MarkRead(IPacketBufferPtr &packetBuffer) override
static ARMNN_DLLEXPORT ProfilingStaticGuid ARMNN_PROFILING_SOL_EVENT_CLASS
ProfilingService & profilingService
A Convolution2dDescriptor for the Convolution2dLayer.
ProfilingState ConfigureProfilingService(const ExternalProfilingOptions &options, bool resetProfilingService=false)
virtual int Connect(IInputSlot &destination)=0
armnn::Runtime::CreationOptions::ExternalProfilingOptions options
int NetworkId
Definition: IRuntime.hpp:19
static ARMNN_DLLEXPORT ProfilingStaticGuid NAME_GUID
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:24
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
const std::string & Get() const
Definition: BackendId.hpp:136
void VerifyTimelineEntityBinaryPacket(Optional< ProfilingGuid > guid, const unsigned char *readableData, unsigned int &offset)

◆ VerifyTimelineEntityBinaryPacket()

void VerifyTimelineEntityBinaryPacket ( Optional< ProfilingGuid guid,
const unsigned char *  readableData,
unsigned int &  offset 
)

Definition at line 228 of file ProfilingTestUtils.cpp.

References BOOST_CHECK(), OptionalBase::has_value(), armnn::profiling::ReadUint32(), armnn::profiling::ReadUint64(), armnn::profiling::uint32_t_size, and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

Referenced by BOOST_AUTO_TEST_CASE(), and VerifyPostOptimisationStructureTestImpl().

231 {
232  BOOST_ASSERT(readableData);
233 
234  // Utils
235  unsigned int uint32_t_size = sizeof(uint32_t);
236  unsigned int uint64_t_size = sizeof(uint64_t);
237 
238  // Reading TimelineEntityClassBinaryPacket
239  uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
240  uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
241  uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
242  uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
243  uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
244 
245  BOOST_CHECK(entityBinaryPacketFamily == 1);
246  BOOST_CHECK(entityBinaryPacketClass == 0);
247  BOOST_CHECK(entityBinaryPacketType == 1);
248  BOOST_CHECK(entityBinaryPacketStreamId == 0);
249 
250  offset += uint32_t_size;
251  uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
252  uint32_t entityBinaryPacketSequenceNumbered = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
253  uint32_t entityBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
254  BOOST_CHECK(entityBinaryPacketSequenceNumbered == 0);
255  BOOST_CHECK(entityBinaryPacketDataLength == 12);
256 
257  // Check the decl_id
258  offset += uint32_t_size;
259  uint32_t entityDeclId = ReadUint32(readableData, offset);
260  BOOST_CHECK(entityDeclId == 1);
261 
262  // Check the profiling GUID
263  offset += uint32_t_size;
264  uint64_t readProfilingGuid = ReadUint64(readableData, offset);
265 
266  if (guid.has_value())
267  {
268  BOOST_CHECK(readProfilingGuid == guid.value());
269  }
270  else
271  {
272  BOOST_CHECK(readProfilingGuid != ProfilingGuid(0));
273  }
274 
275  offset += uint64_t_size;
276 }
uint64_t ReadUint64(const IPacketBufferPtr &packetBuffer, unsigned int offset)
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
bool has_value() const noexcept
Definition: Optional.hpp:53

◆ VerifyTimelineEventBinaryPacket()

void VerifyTimelineEventBinaryPacket ( Optional< uint64_t >  timestamp,
Optional< std::thread::id >  threadId,
Optional< ProfilingGuid eventGuid,
const unsigned char *  readableData,
unsigned int &  offset 
)

Definition at line 278 of file ProfilingTestUtils.cpp.

References BOOST_CHECK(), OptionalBase::has_value(), armnn::profiling::ReadBytes(), armnn::profiling::ReadUint32(), armnn::profiling::ReadUint64(), armnn::profiling::uint32_t_size, and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

Referenced by BOOST_AUTO_TEST_CASE(), and VerifyPostOptimisationStructureTestImpl().

283 {
284  BOOST_ASSERT(readableData);
285 
286  // Utils
287  unsigned int uint32_t_size = sizeof(uint32_t);
288  unsigned int uint64_t_size = sizeof(uint64_t);
289  unsigned int threadId_size = sizeof(std::thread::id);
290 
291  // Reading TimelineEventBinaryPacket
292  uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
293  uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
294  uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
295  uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
296  uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
297 
298  BOOST_CHECK(entityBinaryPacketFamily == 1);
299  BOOST_CHECK(entityBinaryPacketClass == 0);
300  BOOST_CHECK(entityBinaryPacketType == 1);
301  BOOST_CHECK(entityBinaryPacketStreamId == 0);
302 
303  offset += uint32_t_size;
304  uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
305  uint32_t entityBinaryPacketSequenceNumbered = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
306  uint32_t entityBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
307  BOOST_CHECK(entityBinaryPacketSequenceNumbered == 0);
308  BOOST_CHECK(entityBinaryPacketDataLength == 20 + threadId_size);
309 
310  // Check the decl_id
311  offset += uint32_t_size;
312  uint32_t entityDeclId = ReadUint32(readableData, offset);
313  BOOST_CHECK(entityDeclId == 4);
314 
315  // Check the timestamp
316  offset += uint32_t_size;
317  uint64_t readTimestamp = ReadUint64(readableData, offset);
318  if (timestamp.has_value())
319  {
320  BOOST_CHECK(readTimestamp == timestamp.value());
321  }
322  else
323  {
324  BOOST_CHECK(readTimestamp != 0);
325  }
326 
327  // Check the thread id
328  offset += uint64_t_size;
329  std::vector<uint8_t> readThreadId(threadId_size, 0);
330  ReadBytes(readableData, offset, threadId_size, readThreadId.data());
331  if (threadId.has_value())
332  {
333  BOOST_CHECK(readThreadId == threadId.value());
334  }
335  else
336  {
337  BOOST_CHECK(readThreadId == std::this_thread::get_id());
338  }
339 
340  // Check the event GUID
341  offset += threadId_size;
342  uint64_t readEventGuid = ReadUint64(readableData, offset);
343  if (eventGuid.has_value())
344  {
345  BOOST_CHECK(readEventGuid == eventGuid.value());
346  }
347  else
348  {
349  BOOST_CHECK(readEventGuid != ProfilingGuid(0));
350  }
351 
352  offset += uint64_t_size;
353 }
uint64_t ReadUint64(const IPacketBufferPtr &packetBuffer, unsigned int offset)
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
void ReadBytes(const IPacketBufferPtr &packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
bool has_value() const noexcept
Definition: Optional.hpp:53

◆ VerifyTimelineEventClassBinaryPacket()

void VerifyTimelineEventClassBinaryPacket ( ProfilingGuid  guid,
const unsigned char *  readableData,
unsigned int &  offset 
)

Definition at line 88 of file ProfilingTestUtils.cpp.

References BOOST_CHECK(), armnn::profiling::ReadUint32(), armnn::profiling::ReadUint64(), and armnn::profiling::uint32_t_size.

Referenced by BOOST_AUTO_TEST_CASE().

91 {
92  BOOST_ASSERT(readableData);
93 
94  // Utils
95  unsigned int uint32_t_size = sizeof(uint32_t);
96  unsigned int uint64_t_size = sizeof(uint64_t);
97 
98  // Check the TimelineEventClassBinaryPacket header
99  uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
100  uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
101  uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
102  uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
103  uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
104  BOOST_CHECK(entityBinaryPacketFamily == 1);
105  BOOST_CHECK(entityBinaryPacketClass == 0);
106  BOOST_CHECK(entityBinaryPacketType == 1);
107  BOOST_CHECK(entityBinaryPacketStreamId == 0);
108  offset += uint32_t_size;
109  uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
110  uint32_t eventBinaryPacketSequenceNumber = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
111  uint32_t eventBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
112  BOOST_CHECK(eventBinaryPacketSequenceNumber == 0);
113  BOOST_CHECK(eventBinaryPacketDataLength == 12);
114 
115  // Check the decl id
116  offset += uint32_t_size;
117  uint32_t eventClassDeclId = ReadUint32(readableData, offset);
118  BOOST_CHECK(eventClassDeclId == 2);
119 
120  // Check the profiling GUID
121  offset += uint32_t_size;
122  uint64_t readProfilingGuid = ReadUint64(readableData, offset);
123  BOOST_CHECK(readProfilingGuid == guid);
124 
125  // Update the offset to allow parsing to be continued after this function returns
126  offset += uint64_t_size;
127 }
uint64_t ReadUint64(const IPacketBufferPtr &packetBuffer, unsigned int offset)
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)

◆ VerifyTimelineLabelBinaryPacket()

void VerifyTimelineLabelBinaryPacket ( Optional< ProfilingGuid guid,
const std::string &  label,
const unsigned char *  readableData,
unsigned int &  offset 
)

Definition at line 28 of file ProfilingTestUtils.cpp.

References BOOST_CHECK(), OptionalBase::has_value(), OffsetToNextWord(), armnn::profiling::ReadUint32(), armnn::profiling::ReadUint64(), armnn::profiling::uint32_t_size, and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

Referenced by BOOST_AUTO_TEST_CASE(), and VerifyPostOptimisationStructureTestImpl().

32 {
33  BOOST_ASSERT(readableData);
34 
35  // Utils
36  unsigned int uint32_t_size = sizeof(uint32_t);
37  unsigned int uint64_t_size = sizeof(uint64_t);
38  unsigned int label_size = boost::numeric_cast<unsigned int>(label.size());
39 
40  // Check the TimelineLabelBinaryPacket header
41  uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
42  uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
43  uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
44  uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
45  uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
46  BOOST_CHECK(entityBinaryPacketFamily == 1);
47  BOOST_CHECK(entityBinaryPacketClass == 0);
48  BOOST_CHECK(entityBinaryPacketType == 1);
49  BOOST_CHECK(entityBinaryPacketStreamId == 0);
50  offset += uint32_t_size;
51  uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
52  uint32_t eventBinaryPacketSequenceNumber = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
53  uint32_t eventBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
54  BOOST_CHECK(eventBinaryPacketSequenceNumber == 0);
55  BOOST_CHECK(eventBinaryPacketDataLength == 16 + OffsetToNextWord(label_size + 1));
56 
57  // Check the decl id
58  offset += uint32_t_size;
59  uint32_t eventClassDeclId = ReadUint32(readableData, offset);
60  BOOST_CHECK(eventClassDeclId == 0);
61 
62  // Check the profiling GUID
63  offset += uint32_t_size;
64  uint64_t readProfilingGuid = ReadUint64(readableData, offset);
65  if (guid.has_value())
66  {
67  BOOST_CHECK(readProfilingGuid == guid.value());
68  }
69  else
70  {
71  BOOST_CHECK(readProfilingGuid == ProfilingService::Instance().GenerateStaticId(label));
72  }
73 
74  // Check the SWTrace label
75  offset += uint64_t_size;
76  uint32_t swTraceLabelLength = ReadUint32(readableData, offset);
77  BOOST_CHECK(swTraceLabelLength == label_size + 1); // Label length including the null-terminator
78  offset += uint32_t_size;
79  BOOST_CHECK(std::memcmp(readableData + offset, // Offset to the label in the buffer
80  label.data(), // The original label
81  swTraceLabelLength - 1) == 0); // The length of the label
82  BOOST_CHECK(readableData[offset + swTraceLabelLength] == '\0'); // The null-terminator
83 
84  // SWTrace strings are written in blocks of words, so the offset has to be updated to the next whole word
85  offset += OffsetToNextWord(swTraceLabelLength);
86 }
uint64_t ReadUint64(const IPacketBufferPtr &packetBuffer, unsigned int offset)
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
unsigned int OffsetToNextWord(unsigned int numberOfBytes)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
bool has_value() const noexcept
Definition: Optional.hpp:53

◆ VerifyTimelineRelationshipBinaryPacket()

void VerifyTimelineRelationshipBinaryPacket ( ProfilingRelationshipType  relationshipType,
Optional< ProfilingGuid relationshipGuid,
Optional< ProfilingGuid headGuid,
Optional< ProfilingGuid tailGuid,
const unsigned char *  readableData,
unsigned int &  offset 
)

Definition at line 129 of file ProfilingTestUtils.cpp.

References BOOST_CHECK(), DataLink, ExecutionLink, OptionalBase::has_value(), LabelLink, armnn::profiling::ReadUint32(), armnn::profiling::ReadUint64(), RetentionLink, armnn::profiling::uint32_t_size, and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

Referenced by BOOST_AUTO_TEST_CASE(), and VerifyPostOptimisationStructureTestImpl().

135 {
136  BOOST_ASSERT(readableData);
137 
138  uint32_t relationshipTypeUint = 0;
139  switch (relationshipType)
140  {
142  relationshipTypeUint = 0;
143  break;
145  relationshipTypeUint = 1;
146  break;
148  relationshipTypeUint = 2;
149  break;
151  relationshipTypeUint = 3;
152  break;
153  default:
154  BOOST_ERROR("Unknown relationship type");
155  }
156 
157  // Utils
158  unsigned int uint32_t_size = sizeof(uint32_t);
159  unsigned int uint64_t_size = sizeof(uint64_t);
160 
161  // Check the TimelineLabelBinaryPacket header
162  uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
163  uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
164  uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
165  uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
166  uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
167  BOOST_CHECK(entityBinaryPacketFamily == 1);
168  BOOST_CHECK(entityBinaryPacketClass == 0);
169  BOOST_CHECK(entityBinaryPacketType == 1);
170  BOOST_CHECK(entityBinaryPacketStreamId == 0);
171  offset += uint32_t_size;
172  uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
173  uint32_t eventBinaryPacketSequenceNumber = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
174  uint32_t eventBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
175  BOOST_CHECK(eventBinaryPacketSequenceNumber == 0);
176  BOOST_CHECK(eventBinaryPacketDataLength == 32);
177 
178  // Check the decl id
179  offset += uint32_t_size;
180  uint32_t eventClassDeclId = ReadUint32(readableData, offset);
181  BOOST_CHECK(eventClassDeclId == 3);
182 
183  // Check the relationship type
184  offset += uint32_t_size;
185  uint32_t readRelationshipTypeUint = ReadUint32(readableData, offset);
186  BOOST_CHECK(readRelationshipTypeUint == relationshipTypeUint);
187 
188  // Check the relationship GUID
189  offset += uint32_t_size;
190  uint64_t readRelationshipGuid = ReadUint64(readableData, offset);
191  if (relationshipGuid.has_value())
192  {
193  BOOST_CHECK(readRelationshipGuid == relationshipGuid.value());
194  }
195  else
196  {
197  BOOST_CHECK(readRelationshipGuid != ProfilingGuid(0));
198  }
199 
200  // Check the head of relationship GUID
201  offset += uint64_t_size;
202  uint64_t readHeadRelationshipGuid = ReadUint64(readableData, offset);
203  if (headGuid.has_value())
204  {
205  BOOST_CHECK(readHeadRelationshipGuid == headGuid.value());
206  }
207  else
208  {
209  BOOST_CHECK(readHeadRelationshipGuid != ProfilingGuid(0));
210  }
211 
212  // Check the tail of relationship GUID
213  offset += uint64_t_size;
214  uint64_t readTailRelationshipGuid = ReadUint64(readableData, offset);
215  if (tailGuid.has_value())
216  {
217  BOOST_CHECK(readTailRelationshipGuid == tailGuid.value());
218  }
219  else
220  {
221  BOOST_CHECK(readTailRelationshipGuid != ProfilingGuid(0));
222  }
223 
224  // Update the offset to allow parsing to be continued after this function returns
225  offset += uint64_t_size;
226 }
uint64_t ReadUint64(const IPacketBufferPtr &packetBuffer, unsigned int offset)
Head retains(parents) Tail.
Definition: TimelineModel.h:20
Head execution start depends on Tail execution completion.
Definition: TimelineModel.h:21
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
Head uses data of Tail.
Definition: TimelineModel.h:22
bool has_value() const noexcept
Definition: Optional.hpp:53