IVGCVSW-4541 Modify Timeline Packet construction
authorKeith Davis <keith.davis@arm.com>
Thu, 5 Mar 2020 16:25:28 +0000 (16:25 +0000)
committerKeith Davis Arm <keith.davis@arm.com>
Mon, 9 Mar 2020 16:11:25 +0000 (16:11 +0000)
 * Changed TimelinePacket encoding so that there is only one header for
   multiple timeline swtrace messages
 * Refactored function names to have more suitable description
 * Refactored CodeStyle to coincide with ArmNN coding standards
 * Refactored profiling test names to be descriptive
 * Refactored ErrorCode name to TimelineStatus
 * Updated existing unit tests

Signed-off-by: Keith Davis <keith.davis@arm.com>
Change-Id: I83bd4bb9e7393617bca97eba96a6e1388916e5b0

14 files changed:
include/armnn/profiling/ITimelineDecoder.hpp
src/armnn/test/RuntimeTests.cpp
src/profiling/ProfilingUtils.cpp
src/profiling/ProfilingUtils.hpp
src/profiling/SendTimelinePacket.cpp
src/profiling/SendTimelinePacket.hpp
src/profiling/test/ProfilingTestUtils.cpp
src/profiling/test/ProfilingTestUtils.hpp
src/profiling/test/SendTimelinePacketTests.cpp
src/profiling/test/TimelinePacketTests.cpp
src/profiling/test/TimelineUtilityMethodsTests.cpp
src/timelineDecoder/TimelineDecoder.cpp
src/timelineDecoder/TimelineDecoder.hpp
src/timelineDecoder/tests/TimelineTests.cpp

index 7199b38..3a02bb5 100644 (file)
@@ -13,10 +13,10 @@ class ITimelineDecoder
 
 public:
 
-    enum class ErrorCode
+    enum class TimelineStatus
     {
-        ErrorCode_Success,
-        ErrorCode_Fail
+        TimelineStatus_Success,
+        TimelineStatus_Fail
     };
 
     enum class RelationshipType
@@ -60,9 +60,9 @@ public:
 
     virtual ~ITimelineDecoder() = default;
 
-    virtual ErrorCode CreateEntity(const Entity&) = 0;
-    virtual ErrorCode CreateEventClass(const EventClass&) = 0;
-    virtual ErrorCode CreateEvent(const Event&) = 0;
-    virtual ErrorCode CreateLabel(const Label&) = 0;
-    virtual ErrorCode CreateRelationship(const Relationship&) = 0;
+    virtual TimelineStatus CreateEntity(const Entity&) = 0;
+    virtual TimelineStatus CreateEventClass(const EventClass&) = 0;
+    virtual TimelineStatus CreateEvent(const Event&) = 0;
+    virtual TimelineStatus CreateLabel(const Label&) = 0;
+    virtual TimelineStatus CreateRelationship(const Relationship&) = 0;
 };
\ No newline at end of file
index 7263cbd..d9ed18b 100644 (file)
@@ -38,17 +38,17 @@ BOOST_AUTO_TEST_CASE(RuntimeUnloadNetwork)
 {
     // build 2 mock-networks and load them into the runtime
     armnn::IRuntime::CreationOptions options;
-    armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
+    armnn::IRuntimePtr               runtime(armnn::IRuntime::Create(options));
 
     // Mock network 1.
-    armnn::NetworkId networkIdentifier1 = 1;
+    armnn::NetworkId   networkIdentifier1 = 1;
     armnn::INetworkPtr mockNetwork1(armnn::INetwork::Create());
     mockNetwork1->AddInputLayer(0, "test layer");
-    std::vector<armnn::BackendId> backends = {armnn::Compute::CpuRef};
+    std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
     runtime->LoadNetwork(networkIdentifier1, Optimize(*mockNetwork1, backends, runtime->GetDeviceSpec()));
 
     // Mock network 2.
-    armnn::NetworkId networkIdentifier2 = 2;
+    armnn::NetworkId   networkIdentifier2 = 2;
     armnn::INetworkPtr mockNetwork2(armnn::INetwork::Create());
     mockNetwork2->AddInputLayer(0, "test layer");
     runtime->LoadNetwork(networkIdentifier2, Optimize(*mockNetwork2, backends, runtime->GetDeviceSpec()));
@@ -110,16 +110,16 @@ BOOST_AUTO_TEST_CASE(RuntimeMemoryLeak)
     // This means that no pointer to the block can be found. The block is classified as "lost",
     // because the programmer could not possibly have freed it at program exit, since no pointer to it exists.
     unsigned long leakedBefore = 0;
-    unsigned long leakedAfter = 0;
+    unsigned long leakedAfter  = 0;
 
     // A start-pointer or chain of start-pointers to the block is found. Since the block is still pointed at,
     // the programmer could, at least in principle, have freed it before program exit.
     // We want to test this in case memory is not freed as early as it could have been.
     unsigned long reachableBefore = 0;
-    unsigned long reachableAfter = 0;
+    unsigned long reachableAfter  = 0;
 
     // Needed as out params but we don't test them.
-    unsigned long dubious = 0;
+    unsigned long dubious    = 0;
     unsigned long suppressed = 0;
 
     armnn::NetworkId networkIdentifier1 = 1;
@@ -127,11 +127,11 @@ BOOST_AUTO_TEST_CASE(RuntimeMemoryLeak)
     // ensure that runtime is large enough before checking for memory leaks
     // otherwise when loading the network it will automatically reserve memory that won't be released until destruction
     armnn::IRuntime::CreationOptions options;
-    armnn::Runtime runtime(options);
+    armnn::Runtime                   runtime(options);
     armnn::RuntimeLoadedNetworksReserve(&runtime);
 
     {
-        std::vector<armnn::BackendId> backends = {armnn::Compute::CpuRef};
+        std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
 
         std::unique_ptr<armnn::Network> mockNetwork1 = std::make_unique<armnn::Network>();
         mockNetwork1->AddInputLayer(0, "test layer");
@@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE(RuntimeMemoryLeak)
     }
 
     // If we're not running under Valgrind, these vars will have been initialised to 0, so this will always pass.
-    BOOST_TEST(leakedBefore    == leakedAfter);
+    BOOST_TEST(leakedBefore == leakedAfter);
     BOOST_TEST(reachableBefore == reachableAfter);
 
     // These are needed because VALGRIND_COUNT_LEAKS is a macro that assigns to the parameters
@@ -169,7 +169,7 @@ BOOST_AUTO_TEST_CASE(RuntimeCpuRef)
 
     // Create runtime in which test will run
     armnn::IRuntime::CreationOptions options;
-    armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
+    armnn::IRuntimePtr               runtime(armnn::IRuntime::Create(options));
 
     // build up the structure of the network
     INetworkPtr net(INetwork::Create());
@@ -190,7 +190,7 @@ BOOST_AUTO_TEST_CASE(RuntimeCpuRef)
 
     // optimize the network
     std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
-    IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
+    IOptimizedNetworkPtr          optNet   = Optimize(*net, backends, runtime->GetDeviceSpec());
 
     // Load it into the runtime. It should success.
     armnn::NetworkId netId;
@@ -203,7 +203,7 @@ BOOST_AUTO_TEST_CASE(RuntimeFallbackToCpuRef)
 
     // Create runtime in which test will run
     armnn::IRuntime::CreationOptions options;
-    armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
+    armnn::IRuntimePtr               runtime(armnn::IRuntime::Create(options));
 
     // build up the structure of the network
     INetworkPtr net(INetwork::Create());
@@ -225,7 +225,7 @@ BOOST_AUTO_TEST_CASE(RuntimeFallbackToCpuRef)
     // Allow fallback to CpuRef.
     std::vector<armnn::BackendId> backends = { armnn::Compute::CpuAcc, armnn::Compute::CpuRef };
     // optimize the network
-    IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
+    IOptimizedNetworkPtr          optNet   = Optimize(*net, backends, runtime->GetDeviceSpec());
 
     // Load it into the runtime. It should succeed.
     armnn::NetworkId netId;
@@ -239,47 +239,32 @@ BOOST_AUTO_TEST_CASE(IVGCVSW_1929_QuantizedSoftmaxIssue)
 
     // Create runtime in which test will run
     armnn::IRuntime::CreationOptions options;
-    armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
+    armnn::IRuntimePtr               runtime(armnn::IRuntime::Create(options));
 
     // build up the structure of the network
     INetworkPtr net(INetwork::Create());
-    armnn::IConnectableLayer* input = net->AddInputLayer(
-            0,
-            "input"
-    );
-    armnn::IConnectableLayer* softmax = net->AddSoftmaxLayer(
-            armnn::SoftmaxDescriptor(),
-            "softmax"
-    );
-    armnn::IConnectableLayer* output = net->AddOutputLayer(
-            0,
-            "output"
-    );
+    armnn::IConnectableLayer* input   = net->AddInputLayer(0,"input");
+    armnn::IConnectableLayer* softmax = net->AddSoftmaxLayer(armnn::SoftmaxDescriptor(), "softmax");
+    armnn::IConnectableLayer* output  = net->AddOutputLayer(0, "output");
 
     input->GetOutputSlot(0).Connect(softmax->GetInputSlot(0));
     softmax->GetOutputSlot(0).Connect(output->GetInputSlot(0));
 
-    input->GetOutputSlot(0).SetTensorInfo(armnn::TensorInfo(
-            armnn::TensorShape({ 1, 5 }),
-            armnn::DataType::QAsymmU8,
-            1.0f/255,
-            0
-    ));
-
-    softmax->GetOutputSlot(0).SetTensorInfo(armnn::TensorInfo(
-            armnn::TensorShape({ 1, 5 }),
-            armnn::DataType::QAsymmU8
-    ));
-
-    std::vector<armnn::BackendId> backends = {armnn::Compute::CpuRef};
-    std::vector<std::string> errMessages;
-    armnn::IOptimizedNetworkPtr optNet = Optimize(
-            *net,
-            backends,
-            runtime->GetDeviceSpec(),
-            OptimizerOptions(),
-            errMessages
-    );
+    input->GetOutputSlot(0).SetTensorInfo(armnn::TensorInfo(armnn::TensorShape({ 1, 5 }),
+                                                            armnn::DataType::QAsymmU8,
+                                                            1.0f / 255,
+                                                            0));
+
+    softmax->GetOutputSlot(0).SetTensorInfo(armnn::TensorInfo(armnn::TensorShape({ 1, 5 }),
+                                                              armnn::DataType::QAsymmU8));
+
+    std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
+    std::vector<std::string>      errMessages;
+    armnn::IOptimizedNetworkPtr   optNet   = Optimize(*net,
+                                                      backends,
+                                                      runtime->GetDeviceSpec(),
+                                                      OptimizerOptions(),
+                                                      errMessages);
 
     BOOST_TEST(errMessages.size() == 1);
     BOOST_TEST(errMessages[0] ==
@@ -298,22 +283,21 @@ BOOST_AUTO_TEST_CASE(RuntimeBackendOptions)
 
     // Define Options on explicit construction
     BackendOptions options1("FakeBackend1",
-                           {
-                               {"Option1", 1.3f},
-                               {"Option2", true}
-                           });
+                            {
+                                { "Option1", 1.3f },
+                                { "Option2", true }
+                            });
 
     // Add an option after construction
-    options1.AddOption({"Option3", "some_value"});
+    options1.AddOption({ "Option3", "some_value" });
 
     // Add the options to CreationOptions struct
     backendOptions.push_back(options1);
 
     // Add more Options via inplace explicit construction
-    backendOptions.emplace_back(
-        BackendOptions{"FakeBackend1",
-                       {{"Option4", 42}}
-                        });
+    backendOptions.emplace_back(BackendOptions{ "FakeBackend1",
+                                                {{ "Option4", 42 }}
+    });
 
 
     // First group
@@ -343,7 +327,7 @@ BOOST_AUTO_TEST_CASE(ProfilingDisable)
 
     // Create runtime in which the test will run
     armnn::IRuntime::CreationOptions options;
-    armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
+    armnn::IRuntimePtr               runtime(armnn::IRuntime::Create(options));
 
     // build up the structure of the network
     INetworkPtr net(INetwork::Create());
@@ -364,7 +348,7 @@ BOOST_AUTO_TEST_CASE(ProfilingDisable)
 
     // optimize the network
     std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
-    IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
+    IOptimizedNetworkPtr          optNet   = Optimize(*net, backends, runtime->GetDeviceSpec());
 
     // Load it into the runtime. It should succeed.
     armnn::NetworkId netId;
@@ -406,7 +390,7 @@ BOOST_AUTO_TEST_CASE(ProfilingEnableCpuRef)
 
     // optimize the network
     std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
-    IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
+    IOptimizedNetworkPtr          optNet   = Optimize(*net, backends, runtime->GetDeviceSpec());
 
     ProfilingGuid optNetGuid = optNet->GetGuid();
 
@@ -422,268 +406,272 @@ BOOST_AUTO_TEST_CASE(ProfilingEnableCpuRef)
     BOOST_CHECK(readableBuffer != nullptr);
 
     unsigned int size = readableBuffer->GetSize();
-    BOOST_CHECK(size == 1356);
+    BOOST_CHECK(size == 1068);
 
     const unsigned char* readableData = readableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     unsigned int offset = 0;
 
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 1060);
+
     // Post-optimisation network
     // Network entity
-    VerifyTimelineEntityBinaryPacket(optNetGuid, readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(optNetGuid, readableData, offset
+                                        );
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           LabelsAndEventClasses::NETWORK_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               LabelsAndEventClasses::NETWORK_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Input layer
     // Input layer entity
-    VerifyTimelineEntityBinaryPacket(input->GetGuid(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(input->GetGuid(), readableData, offset);
 
     // Name Entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), "input", readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "input", readableData, offset);
 
     // Entity - Name relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           input->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               input->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Name label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::NAME_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::NAME_GUID,
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           input->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               input->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Network - Input layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           input->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               input->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Normalization layer
     // Normalization layer entity
-    VerifyTimelineEntityBinaryPacket(normalize->GetGuid(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(normalize->GetGuid(), readableData, offset);
 
     // Name entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), "normalization", readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "normalization", readableData, offset);
 
     // Entity - Name relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           normalize->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               normalize->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Name label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::NAME_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::NAME_GUID,
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           normalize->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               normalize->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Network - Normalize layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           normalize->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               normalize->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Input layer - Normalize layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           input->GetGuid(),
-                                           normalize->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               input->GetGuid(),
+                                               normalize->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::CONNECTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::CONNECTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Normalization workload
     // Normalization workload entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // BackendId entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), "CpuRef", readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "CpuRef", readableData, offset);
 
     // Entity - BackendId relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // BackendId label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::BACKENDID_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::BACKENDID_GUID,
+                                               readableData,
+                                               offset);
 
     // Normalize layer - Normalize workload relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           normalize->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               normalize->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Output layer
     // Output layer entity
-    VerifyTimelineEntityBinaryPacket(output->GetGuid(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(output->GetGuid(), readableData, offset);
 
     // Name entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), "output", readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "output", readableData, offset);
 
     // Entity - Name relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           output->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               output->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Name label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::NAME_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::NAME_GUID,
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           output->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               output->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Network - Output layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           output->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               output->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Normalize layer - Output layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           normalize->GetGuid(),
-                                           output->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               normalize->GetGuid(),
+                                               output->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::CONNECTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::CONNECTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     bufferManager.MarkRead(readableBuffer);
 
@@ -691,13 +679,13 @@ BOOST_AUTO_TEST_CASE(ProfilingEnableCpuRef)
     std::vector<float> inputData(16);
     std::vector<float> outputData(16);
 
-    InputTensors inputTensors
+    InputTensors  inputTensors
     {
-        {0, ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputData.data())}
+        { 0, ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputData.data()) }
     };
     OutputTensors outputTensors
     {
-        {0, Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data())}
+        { 0, Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data()) }
     };
 
     // Does the inference.
@@ -717,425 +705,434 @@ BOOST_AUTO_TEST_CASE(ProfilingEnableCpuRef)
 
     // Validate input workload data
     size = inputReadableBuffer->GetSize();
-    BOOST_CHECK(size == 252);
+    BOOST_CHECK(size == 204);
 
     readableData = inputReadableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     offset = 0;
 
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 196);
+
     // Input workload
     // Input workload entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // BackendId entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), "CpuRef", readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "CpuRef", readableData, offset);
 
     // Entity - BackendId relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // BackendId label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::BACKENDID_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::BACKENDID_GUID,
+                                               readableData,
+                                               offset);
 
     // Input layer - Input workload relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           input->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               input->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     bufferManager.MarkRead(inputReadableBuffer);
 
     // Validate output workload data
     size = outputReadableBuffer->GetSize();
-    BOOST_CHECK(size == 252);
+    BOOST_CHECK(size == 204);
 
     readableData = outputReadableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     offset = 0;
 
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 196);
+
     // Output workload
     // Output workload entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // BackendId entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), "CpuRef", readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "CpuRef", readableData, offset);
 
     // Entity - BackendId relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // BackendId label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::BACKENDID_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::BACKENDID_GUID,
+                                               readableData,
+                                               offset);
 
     // Output layer - Output workload relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           output->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               output->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     bufferManager.MarkRead(outputReadableBuffer);
 
     // Validate inference data
     size = inferenceReadableBuffer->GetSize();
-    BOOST_CHECK(size == 1608);
+    BOOST_CHECK(size == 1272);
 
     readableData = inferenceReadableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     offset = 0;
 
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 1264);
+
     // Inference timeline trace
     // Inference entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::INFERENCE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::INFERENCE_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Network - Inference relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Start Inference life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Inference - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // Execution
     // Input workload execution
     // Input workload execution entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Inference - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Workload - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Start Input workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Input workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // End of Input workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Input workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // Normalize workload execution
     // Normalize workload execution entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Inference - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Workload - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Start Normalize workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Normalize workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // End of Normalize workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Normalize workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // Output workload execution
     // Output workload execution entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Inference - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Workload - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Start Output workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Output workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // End of Normalize workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Output workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // End of Inference life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Inference - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     bufferManager.MarkRead(inferenceReadableBuffer);
 }
index 3b06a26..002eeb9 100644 (file)
@@ -454,14 +454,14 @@ std::pair<uint32_t, uint32_t> CreateTimelineMessagePacketHeader(unsigned int dat
 TimelinePacketStatus WriteTimelineLabelBinaryPacket(uint64_t profilingGuid,
                                                     const std::string& label,
                                                     unsigned char* buffer,
-                                                    unsigned int bufferSize,
+                                                    unsigned int remainingBufferSize,
                                                     unsigned int& numberOfBytesWritten)
 {
     // Initialize the output value
     numberOfBytesWritten = 0;
 
     // Check that the given buffer is valid
-    if (buffer == nullptr || bufferSize == 0)
+    if (buffer == nullptr || remainingBufferSize == 0)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
@@ -486,28 +486,15 @@ TimelinePacketStatus WriteTimelineLabelBinaryPacket(uint64_t profilingGuid,
                                                  uint64_t_size +   // Profiling GUID
                                                  swTraceLabelSize; // Label
 
-    // Calculate the timeline binary packet size (in bytes)
-    unsigned int timelineLabelPacketSize = 2 * uint32_t_size +            // Header (2 words)
-                                           timelineLabelPacketDataLength; // decl_Id + Profiling GUID + label
-
     // Check whether the timeline binary packet fits in the given buffer
-    if (timelineLabelPacketSize > bufferSize)
+    if (timelineLabelPacketDataLength > remainingBufferSize)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
 
-    // Create packet header
-    std::pair<uint32_t, uint32_t> packetHeader = CreateTimelineMessagePacketHeader(timelineLabelPacketDataLength);
-
     // Initialize the offset for writing in the buffer
     unsigned int offset = 0;
 
-    // Write the timeline binary packet header to the buffer
-    WriteUint32(buffer, offset, packetHeader.first);
-    offset += uint32_t_size;
-    WriteUint32(buffer, offset, packetHeader.second);
-    offset += uint32_t_size;
-
     // Write decl_Id to the buffer
     WriteUint32(buffer, offset, 0u);
     offset += uint32_t_size;
@@ -522,21 +509,21 @@ TimelinePacketStatus WriteTimelineLabelBinaryPacket(uint64_t profilingGuid,
     }
 
     // Update the number of bytes written
-    numberOfBytesWritten = timelineLabelPacketSize;
+    numberOfBytesWritten = timelineLabelPacketDataLength;
 
     return TimelinePacketStatus::Ok;
 }
 
-TimelinePacketStatus WriteTimelineEntityBinaryPacket(uint64_t profilingGuid,
-                                                     unsigned char* buffer,
-                                                     unsigned int bufferSize,
-                                                     unsigned int& numberOfBytesWritten)
+TimelinePacketStatus WriteTimelineEntityBinary(uint64_t profilingGuid,
+                                               unsigned char* buffer,
+                                               unsigned int remainingBufferSize,
+                                               unsigned int& numberOfBytesWritten)
 {
     // Initialize the output value
     numberOfBytesWritten = 0;
 
     // Check that the given buffer is valid
-    if (buffer == nullptr || bufferSize == 0)
+    if (buffer == nullptr || remainingBufferSize == 0)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
@@ -546,31 +533,17 @@ TimelinePacketStatus WriteTimelineEntityBinaryPacket(uint64_t profilingGuid,
     unsigned int uint64_t_size = sizeof(uint64_t);
 
     // Calculate the length of the data (in bytes)
-    unsigned int timelineEntityPacketDataLength = uint32_t_size + uint64_t_size;  // decl_id + Profiling GUID
-
-
-    // Calculate the timeline binary packet size (in bytes)
-    unsigned int timelineEntityPacketSize = 2 * uint32_t_size +             // Header (2 words)
-                                            timelineEntityPacketDataLength; // Profiling GUID
+    unsigned int timelineEntityDataLength = uint32_t_size + uint64_t_size;  // decl_id + Profiling GUID
 
     // Check whether the timeline binary packet fits in the given buffer
-    if (timelineEntityPacketSize > bufferSize)
+    if (timelineEntityDataLength > remainingBufferSize)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
 
-    // Create packet header
-    std::pair<uint32_t, uint32_t> packetHeader = CreateTimelineMessagePacketHeader(timelineEntityPacketDataLength);
-
     // Initialize the offset for writing in the buffer
     unsigned int offset = 0;
 
-    // Write the timeline binary packet header to the buffer
-    WriteUint32(buffer, offset, packetHeader.first);
-    offset += uint32_t_size;
-    WriteUint32(buffer, offset, packetHeader.second);
-    offset += uint32_t_size;
-
     // Write the decl_Id to the buffer
     WriteUint32(buffer, offset, 1u);
     offset += uint32_t_size;
@@ -579,24 +552,24 @@ TimelinePacketStatus WriteTimelineEntityBinaryPacket(uint64_t profilingGuid,
     WriteUint64(buffer, offset, profilingGuid); // Profiling GUID
 
     // Update the number of bytes written
-    numberOfBytesWritten = timelineEntityPacketSize;
+    numberOfBytesWritten = timelineEntityDataLength;
 
     return TimelinePacketStatus::Ok;
 }
 
-TimelinePacketStatus WriteTimelineRelationshipBinaryPacket(ProfilingRelationshipType relationshipType,
-                                                           uint64_t relationshipGuid,
-                                                           uint64_t headGuid,
-                                                           uint64_t tailGuid,
-                                                           unsigned char* buffer,
-                                                           unsigned int bufferSize,
-                                                           unsigned int& numberOfBytesWritten)
+TimelinePacketStatus WriteTimelineRelationshipBinary(ProfilingRelationshipType relationshipType,
+                                                     uint64_t relationshipGuid,
+                                                     uint64_t headGuid,
+                                                     uint64_t tailGuid,
+                                                     unsigned char* buffer,
+                                                     unsigned int remainingBufferSize,
+                                                     unsigned int& numberOfBytesWritten)
 {
     // Initialize the output value
     numberOfBytesWritten = 0;
 
     // Check that the given buffer is valid
-    if (buffer == nullptr || bufferSize == 0)
+    if (buffer == nullptr || remainingBufferSize == 0)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
@@ -606,32 +579,18 @@ TimelinePacketStatus WriteTimelineRelationshipBinaryPacket(ProfilingRelationship
     unsigned int uint64_t_size = sizeof(uint64_t);
 
     // Calculate the length of the data (in bytes)
-    unsigned int timelineRelationshipPacketDataLength = uint32_t_size * 2 + // decl_id + Relationship Type
-                                                        uint64_t_size * 3; // Relationship GUID + Head GUID + tail GUID
+    unsigned int timelineRelationshipDataLength = uint32_t_size * 2 + // decl_id + Relationship Type
+                                                  uint64_t_size * 3;  // Relationship GUID + Head GUID + tail GUID
 
-    // Calculate the timeline binary packet size (in bytes)
-    unsigned int timelineRelationshipPacketSize = 2 * uint32_t_size + // Header (2 words)
-                                                  timelineRelationshipPacketDataLength;
-
-    // Check whether the timeline binary packet fits in the given buffer
-    if (timelineRelationshipPacketSize > bufferSize)
+    // Check whether the timeline binary fits in the given buffer
+    if (timelineRelationshipDataLength > remainingBufferSize)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
 
-    // Create packet header
-    uint32_t dataLength = boost::numeric_cast<uint32_t>(timelineRelationshipPacketDataLength);
-    std::pair<uint32_t, uint32_t> packetHeader = CreateTimelineMessagePacketHeader(dataLength);
-
     // Initialize the offset for writing in the buffer
     unsigned int offset = 0;
 
-    // Write the timeline binary packet header to the buffer
-    WriteUint32(buffer, offset, packetHeader.first);
-    offset += uint32_t_size;
-    WriteUint32(buffer, offset, packetHeader.second);
-    offset += uint32_t_size;
-
     uint32_t relationshipTypeUint = 0;
 
     switch (relationshipType)
@@ -652,7 +611,7 @@ TimelinePacketStatus WriteTimelineRelationshipBinaryPacket(ProfilingRelationship
             throw InvalidArgumentException("Unknown relationship type given.");
     }
 
-    // Write the timeline binary packet payload to the buffer
+    // Write the timeline binary payload to the buffer
     // decl_id of the timeline message
     uint32_t declId = 3;
     WriteUint32(buffer, offset, declId); // decl_id
@@ -666,20 +625,20 @@ TimelinePacketStatus WriteTimelineRelationshipBinaryPacket(ProfilingRelationship
     WriteUint64(buffer, offset, tailGuid); // tail of relationship GUID
 
     // Update the number of bytes written
-    numberOfBytesWritten = timelineRelationshipPacketSize;
+    numberOfBytesWritten = timelineRelationshipDataLength;
 
     return TimelinePacketStatus::Ok;
 }
 
 TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
-                                                          unsigned int bufferSize,
+                                                          unsigned int remainingBufferSize,
                                                           unsigned int& numberOfBytesWritten)
 {
     // Initialize the output value
     numberOfBytesWritten = 0;
 
     // Check that the given buffer is valid
-    if (buffer == nullptr || bufferSize == 0)
+    if (buffer == nullptr || remainingBufferSize == 0)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
@@ -747,7 +706,7 @@ TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
                                                dataLength;         // Payload
 
     // Check whether the timeline directory binary packet fits in the given buffer
-    if (timelineDirectoryPacketSize > bufferSize)
+    if (timelineDirectoryPacketSize > remainingBufferSize)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
@@ -799,16 +758,16 @@ TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
     return TimelinePacketStatus::Ok;
 }
 
-TimelinePacketStatus WriteTimelineEventClassBinaryPacket(uint64_t profilingGuid,
-                                                         unsigned char* buffer,
-                                                         unsigned int bufferSize,
-                                                         unsigned int& numberOfBytesWritten)
+TimelinePacketStatus WriteTimelineEventClassBinary(uint64_t profilingGuid,
+                                                   unsigned char* buffer,
+                                                   unsigned int remainingBufferSize,
+                                                   unsigned int& numberOfBytesWritten)
 {
     // Initialize the output value
     numberOfBytesWritten = 0;
 
     // Check that the given buffer is valid
-    if (buffer == nullptr || bufferSize == 0)
+    if (buffer == nullptr || remainingBufferSize == 0)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
@@ -821,53 +780,39 @@ TimelinePacketStatus WriteTimelineEventClassBinaryPacket(uint64_t profilingGuid,
     uint32_t declId = 2;
 
     // Calculate the length of the data (in bytes)
-    unsigned int packetBodySize = uint32_t_size + uint64_t_size; // decl_id + Profiling GUID
+    unsigned int dataSize = uint32_t_size + uint64_t_size; // decl_id + Profiling GUID
 
-    // Calculate the timeline binary packet size (in bytes)
-    unsigned int packetSize = 2 * uint32_t_size + // Header (2 words)
-                              packetBodySize;     // Body
-
-    // Check whether the timeline binary packet fits in the given buffer
-    if (packetSize > bufferSize)
+    // Check whether the timeline binary fits in the given buffer
+    if (dataSize > remainingBufferSize)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
 
-    // Create packet header
-    std::pair<uint32_t, uint32_t> packetHeader = CreateTimelineMessagePacketHeader(packetBodySize);
-
     // Initialize the offset for writing in the buffer
     unsigned int offset = 0;
 
-    // Write the timeline binary packet header to the buffer
-    WriteUint32(buffer, offset, packetHeader.first);
-    offset += uint32_t_size;
-    WriteUint32(buffer, offset, packetHeader.second);
-    offset += uint32_t_size;
-
-    // Write the timeline binary packet payload to the buffer
+    // Write the timeline binary payload to the buffer
     WriteUint32(buffer, offset, declId);        // decl_id
     offset += uint32_t_size;
     WriteUint64(buffer, offset, profilingGuid); // Profiling GUID
 
     // Update the number of bytes written
-    numberOfBytesWritten = packetSize;
+    numberOfBytesWritten = dataSize;
 
     return TimelinePacketStatus::Ok;
 }
 
-TimelinePacketStatus WriteTimelineEventBinaryPacket(uint64_t timestamp,
-                                                    std::thread::id threadId,
-                                                    uint64_t profilingGuid,
-                                                    unsigned char* buffer,
-                                                    unsigned int bufferSize,
-                                                    unsigned int& numberOfBytesWritten)
+TimelinePacketStatus WriteTimelineEventBinary(uint64_t timestamp,
+                                              std::thread::id threadId,
+                                              uint64_t profilingGuid,
+                                              unsigned char* buffer,
+                                              unsigned int remainingBufferSize,
+                                              unsigned int& numberOfBytesWritten)
 {
     // Initialize the output value
     numberOfBytesWritten = 0;
-
     // Check that the given buffer is valid
-    if (buffer == nullptr || bufferSize == 0)
+    if (buffer == nullptr || remainingBufferSize == 0)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
@@ -881,34 +826,21 @@ TimelinePacketStatus WriteTimelineEventBinaryPacket(uint64_t timestamp,
     uint32_t declId = 4;
 
     // Calculate the length of the data (in bytes)
-    unsigned int timelineEventPacketDataLength = uint32_t_size + // decl_id
-                                                 uint64_t_size + // Timestamp
-                                                 threadId_size + // Thread id
-                                                 uint64_t_size;  // Profiling GUID
-
-    // Calculate the timeline binary packet size (in bytes)
-    unsigned int timelineEventPacketSize = 2 * uint32_t_size +            // Header (2 words)
-                                           timelineEventPacketDataLength; // Timestamp + thread id + profiling GUID
+    unsigned int timelineEventDataLength = uint32_t_size + // decl_id
+                                           uint64_t_size + // Timestamp
+                                           threadId_size + // Thread id
+                                           uint64_t_size;  // Profiling GUID
 
     // Check whether the timeline binary packet fits in the given buffer
-    if (timelineEventPacketSize > bufferSize)
+    if (timelineEventDataLength > remainingBufferSize)
     {
         return TimelinePacketStatus::BufferExhaustion;
     }
 
-    // Create packet header
-    std::pair<uint32_t, uint32_t> packetHeader = CreateTimelineMessagePacketHeader(timelineEventPacketDataLength);
-
     // Initialize the offset for writing in the buffer
     unsigned int offset = 0;
 
-    // Write the timeline binary packet header to the buffer
-    WriteUint32(buffer, offset, packetHeader.first);
-    offset += uint32_t_size;
-    WriteUint32(buffer, offset, packetHeader.second);
-    offset += uint32_t_size;
-
-    // Write the timeline binary packet payload to the buffer
+    // Write the timeline binary payload to the buffer
     WriteUint32(buffer, offset, declId); // decl_id
     offset += uint32_t_size;
     WriteUint64(buffer, offset, timestamp); // Timestamp
@@ -917,9 +849,8 @@ TimelinePacketStatus WriteTimelineEventBinaryPacket(uint64_t timestamp,
     offset += threadId_size;
     WriteUint64(buffer, offset, profilingGuid); // Profiling GUID
     offset += uint64_t_size;
-
     // Update the number of bytes written
-    numberOfBytesWritten = timelineEventPacketSize;
+    numberOfBytesWritten = timelineEventDataLength;
 
     return TimelinePacketStatus::Ok;
 }
index a63f255..2604361 100644 (file)
@@ -183,6 +183,13 @@ uint16_t ReadUint16(unsigned const char* buffer, unsigned int offset);
 
 uint8_t ReadUint8(unsigned const char* buffer, unsigned int offset);
 
+std::pair<uint32_t, uint32_t> CreateTimelinePacketHeader(uint32_t packetFamily,
+                                                         uint32_t packetClass,
+                                                         uint32_t packetType,
+                                                         uint32_t streamId,
+                                                         uint32_t sequenceNumbered,
+                                                         uint32_t dataLength);
+
 std::string GetSoftwareInfo();
 
 std::string GetSoftwareVersion();
@@ -208,34 +215,34 @@ TimelinePacketStatus WriteTimelineLabelBinaryPacket(uint64_t profilingGuid,
                                                     unsigned int bufferSize,
                                                     unsigned int& numberOfBytesWritten);
 
-TimelinePacketStatus WriteTimelineEntityBinaryPacket(uint64_t profilingGuid,
+TimelinePacketStatus WriteTimelineEntityBinary(uint64_t profilingGuid,
+                                               unsigned char* buffer,
+                                               unsigned int bufferSize,
+                                               unsigned int& numberOfBytesWritten);
+
+TimelinePacketStatus WriteTimelineRelationshipBinary(ProfilingRelationshipType relationshipType,
+                                                     uint64_t relationshipGuid,
+                                                     uint64_t headGuid,
+                                                     uint64_t tailGuid,
                                                      unsigned char* buffer,
                                                      unsigned int bufferSize,
                                                      unsigned int& numberOfBytesWritten);
 
-TimelinePacketStatus WriteTimelineRelationshipBinaryPacket(ProfilingRelationshipType relationshipType,
-                                                           uint64_t relationshipGuid,
-                                                           uint64_t headGuid,
-                                                           uint64_t tailGuid,
-                                                           unsigned char* buffer,
-                                                           unsigned int bufferSize,
-                                                           unsigned int& numberOfBytesWritten);
-
 TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
                                                           unsigned int bufferSize,
                                                           unsigned int& numberOfBytesWritten);
 
-TimelinePacketStatus WriteTimelineEventClassBinaryPacket(uint64_t profilingGuid,
-                                                         unsigned char* buffer,
-                                                         unsigned int bufferSize,
-                                                         unsigned int& numberOfBytesWritten);
-
-TimelinePacketStatus WriteTimelineEventBinaryPacket(uint64_t timestamp,
-                                                    std::thread::id threadId,
-                                                    uint64_t profilingGuid,
-                                                    unsigned char* buffer,
-                                                    unsigned int bufferSize,
-                                                    unsigned int& numberOfBytesWritten);
+TimelinePacketStatus WriteTimelineEventClassBinary(uint64_t profilingGuid,
+                                                   unsigned char* buffer,
+                                                   unsigned int bufferSize,
+                                                   unsigned int& numberOfBytesWritten);
+
+TimelinePacketStatus WriteTimelineEventBinary(uint64_t timestamp,
+                                              std::thread::id threadId,
+                                              uint64_t profilingGuid,
+                                              unsigned char* buffer,
+                                              unsigned int bufferSize,
+                                              unsigned int& numberOfBytesWritten);
 
 std::string CentreAlignFormatting(const std::string& stringToPass, const int spacingWidth);
 
index d769b64..5152d66 100644 (file)
@@ -19,11 +19,35 @@ void SendTimelinePacket::Commit()
         return;
     }
 
+    if (!m_DirectoryPackage)
+    {
+        // Datalength should be Offset minus the two header words
+        m_PacketDataLength = m_Offset - m_uint32_t_size * 2;
+        // Reset offset to prepend header with full packet datalength
+        m_Offset = 0;
+
+        // Add header before commit
+        m_PacketHeader = CreateTimelinePacketHeader(1,0,1,0,0,m_PacketDataLength);
+
+        // Write the timeline binary packet header to the buffer
+        WriteUint32(m_WriteBuffer->GetWritableData(), m_Offset, m_PacketHeader.first);
+        m_Offset += m_uint32_t_size;
+        WriteUint32(m_WriteBuffer->GetWritableData(), m_Offset, m_PacketHeader.second);
+
+        m_BufferManager.Commit(m_WriteBuffer, m_PacketDataLength + m_uint32_t_size * 2);
+
+    }
+    else
+    {
+        m_DirectoryPackage = false;
+        m_BufferManager.Commit(m_WriteBuffer, m_Offset);
+    }
+
     // Commit the message
-    m_BufferManager.Commit(m_WriteBuffer, m_Offset);
     m_WriteBuffer.reset(nullptr);
-    m_Offset = 0;
-    m_BufferSize = 0;
+    // Reset offset to start after prepended header
+    m_Offset = 8;
+    m_RemainingBufferSize = 0;
 }
 
 void SendTimelinePacket::ReserveBuffer()
@@ -45,12 +69,18 @@ void SendTimelinePacket::ReserveBuffer()
         throw BufferExhaustion("No space left on buffer", CHECK_LOCATION());
     }
 
-    m_BufferSize = reserved;
+    if (m_DirectoryPackage)
+    {
+        m_RemainingBufferSize = reserved;
+        return;
+    }
+    // Account for the header size which is added at Commit()
+    m_RemainingBufferSize = reserved - 8;
 }
 
 void SendTimelinePacket::SendTimelineEntityBinaryPacket(uint64_t profilingGuid)
 {
-    ForwardWriteBinaryFunction(WriteTimelineEntityBinaryPacket,
+    ForwardWriteBinaryFunction(WriteTimelineEntityBinary,
                                profilingGuid);
 }
 
@@ -58,7 +88,7 @@ void SendTimelinePacket::SendTimelineEventBinaryPacket(uint64_t timestamp,
                                                        std::thread::id threadId,
                                                        uint64_t profilingGuid)
 {
-    ForwardWriteBinaryFunction(WriteTimelineEventBinaryPacket,
+    ForwardWriteBinaryFunction(WriteTimelineEventBinary,
                                timestamp,
                                threadId,
                                profilingGuid);
@@ -66,7 +96,7 @@ void SendTimelinePacket::SendTimelineEventBinaryPacket(uint64_t timestamp,
 
 void SendTimelinePacket::SendTimelineEventClassBinaryPacket(uint64_t profilingGuid)
 {
-    ForwardWriteBinaryFunction(WriteTimelineEventClassBinaryPacket,
+    ForwardWriteBinaryFunction(WriteTimelineEventClassBinary,
                                profilingGuid);
 }
 
@@ -82,7 +112,7 @@ void SendTimelinePacket::SendTimelineRelationshipBinaryPacket(ProfilingRelations
                                                               uint64_t headGuid,
                                                               uint64_t tailGuid)
 {
-    ForwardWriteBinaryFunction(WriteTimelineRelationshipBinaryPacket,
+    ForwardWriteBinaryFunction(WriteTimelineRelationshipBinary,
                                relationshipType,
                                relationshipGuid,
                                headGuid,
@@ -93,13 +123,17 @@ void SendTimelinePacket::SendTimelineMessageDirectoryPackage()
 {
     try
     {
+        // Flag to Reserve & Commit() that a DirectoryPackage is being sent
+        m_DirectoryPackage = true;
         // Reserve buffer if it hasn't already been reserved
         ReserveBuffer();
-
         // Write to buffer
         unsigned int numberOfBytesWritten = 0;
+        // Offset is initialised to 8
+        m_Offset = 0;
+
         TimelinePacketStatus result = WriteTimelineMessageDirectoryPackage(&m_WriteBuffer->GetWritableData()[m_Offset],
-                                                                           m_BufferSize,
+                                                                           m_RemainingBufferSize,
                                                                            numberOfBytesWritten);
         if (result != armnn::profiling::TimelinePacketStatus::Ok)
         {
@@ -108,7 +142,7 @@ void SendTimelinePacket::SendTimelineMessageDirectoryPackage()
 
         // Commit the message
         m_Offset     += numberOfBytesWritten;
-        m_BufferSize -= numberOfBytesWritten;
+        m_RemainingBufferSize -= numberOfBytesWritten;
         Commit();
     }
     catch (...)
index 737a1aa..b3b4aa1 100644 (file)
@@ -25,8 +25,8 @@ public:
     SendTimelinePacket(IBufferManager& bufferManager)
       : m_BufferManager(bufferManager)
       , m_WriteBuffer(nullptr)
-      , m_Offset(0u)
-      , m_BufferSize(0u)
+      , m_Offset(8u)
+      , m_RemainingBufferSize(0u)
     {}
 
     /// Commits the current buffer and reset the member variables
@@ -59,13 +59,20 @@ private:
     template <typename Func, typename ... Params>
     void ForwardWriteBinaryFunction(Func& func, Params&& ... params);
 
-    IBufferManager& m_BufferManager;
+    IBufferManager&  m_BufferManager;
     IPacketBufferPtr m_WriteBuffer;
-    unsigned int m_Offset;
-    unsigned int m_BufferSize;
+    unsigned int     m_Offset;
+    unsigned int     m_RemainingBufferSize;
+
+    const unsigned int m_uint32_t_size = sizeof(uint32_t);
+
+    std::pair<uint32_t, uint32_t> m_PacketHeader;
+    uint32_t                      m_PacketDataLength;
+
+    bool m_DirectoryPackage = false;
 };
 
-template <typename Func, typename ... Params>
+template<typename Func, typename ... Params>
 void SendTimelinePacket::ForwardWriteBinaryFunction(Func& func, Params&& ... params)
 {
     try
@@ -73,30 +80,31 @@ void SendTimelinePacket::ForwardWriteBinaryFunction(Func& func, Params&& ... par
         ReserveBuffer();
         BOOST_ASSERT(m_WriteBuffer);
         unsigned int numberOfBytesWritten = 0;
-        while (true)
+        // Header will be prepended to the buffer on Commit()
+        while ( true )
         {
             TimelinePacketStatus result = func(std::forward<Params>(params)...,
                                                &m_WriteBuffer->GetWritableData()[m_Offset],
-                                               m_BufferSize,
+                                               m_RemainingBufferSize,
                                                numberOfBytesWritten);
-            switch (result)
+            switch ( result )
             {
-            case TimelinePacketStatus::BufferExhaustion:
-                Commit();
-                ReserveBuffer();
-                continue;
-
-            case TimelinePacketStatus::Error:
-                throw RuntimeException("Error processing while sending TimelineBinaryPacket", CHECK_LOCATION());
-
-            default:
-                m_Offset     += numberOfBytesWritten;
-                m_BufferSize -= numberOfBytesWritten;
-                return;
+                case TimelinePacketStatus::BufferExhaustion:
+                    Commit();
+                    ReserveBuffer();
+                    continue;
+
+                case TimelinePacketStatus::Error:
+                    throw RuntimeException("Error processing while sending TimelineBinaryPacket",
+                                           CHECK_LOCATION());
+
+                default:m_Offset += numberOfBytesWritten;
+                    m_RemainingBufferSize -= numberOfBytesWritten;
+                    return;
             }
         }
     }
-    catch (...)
+    catch ( ... )
     {
         throw RuntimeException("Error processing while sending TimelineBinaryPacket", CHECK_LOCATION());
     }
index dd54ca9..89b5926 100644 (file)
@@ -25,19 +25,16 @@ inline unsigned int OffsetToNextWord(unsigned int numberOfBytes)
     return numberOfBytes + uint32_t_size - remainder;
 }
 
-void VerifyTimelineLabelBinaryPacket(Optional<ProfilingGuid> guid,
-                                     const std::string& label,
-                                     const unsigned char* readableData,
-                                     unsigned int& offset)
+void VerifyTimelineHeaderBinary(const unsigned char* readableData,
+                                unsigned int& offset,
+                                uint32_t packetDataLength)
 {
     BOOST_ASSERT(readableData);
 
     // Utils
     unsigned int uint32_t_size = sizeof(uint32_t);
-    unsigned int uint64_t_size = sizeof(uint64_t);
-    unsigned int label_size    = boost::numeric_cast<unsigned int>(label.size());
 
-    // Check the TimelineLabelBinaryPacket header
+    // Check the TimelineEventClassBinaryPacket header
     uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
     uint32_t entityBinaryPacketFamily      = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
     uint32_t entityBinaryPacketClass       = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
@@ -52,10 +49,23 @@ void VerifyTimelineLabelBinaryPacket(Optional<ProfilingGuid> guid,
     uint32_t eventBinaryPacketSequenceNumber = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
     uint32_t eventBinaryPacketDataLength     = (entityBinaryPacketHeaderWord1 >>  0) & 0x00FFFFFF;
     BOOST_CHECK(eventBinaryPacketSequenceNumber == 0);
-    BOOST_CHECK(eventBinaryPacketDataLength     == 16 + OffsetToNextWord(label_size + 1));
+    BOOST_CHECK(eventBinaryPacketDataLength     == packetDataLength);
+    offset += uint32_t_size;
+}
+
+void VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid,
+                                         const std::string& label,
+                                         const unsigned char* readableData,
+                                         unsigned int& offset)
+{
+    BOOST_ASSERT(readableData);
+
+    // Utils
+    unsigned int uint32_t_size = sizeof(uint32_t);
+    unsigned int uint64_t_size = sizeof(uint64_t);
+    unsigned int label_size    = boost::numeric_cast<unsigned int>(label.size());
 
     // Check the decl id
-    offset += uint32_t_size;
     uint32_t eventClassDeclId = ReadUint32(readableData, offset);
     BOOST_CHECK(eventClassDeclId == 0);
 
@@ -74,20 +84,19 @@ void VerifyTimelineLabelBinaryPacket(Optional<ProfilingGuid> guid,
     // Check the SWTrace label
     offset += uint64_t_size;
     uint32_t swTraceLabelLength = ReadUint32(readableData, offset);
-    BOOST_CHECK(swTraceLabelLength == label_size + 1); // Label length including the null-terminator
+    BOOST_CHECK(swTraceLabelLength == label_size + 1);               // Label length including the null-terminator
     offset += uint32_t_size;
     BOOST_CHECK(std::memcmp(readableData + offset,                  // Offset to the label in the buffer
-                            label.data(),                           // The original label
-                            swTraceLabelLength - 1) == 0);          // The length of the label
-    BOOST_CHECK(readableData[offset + swTraceLabelLength] == '\0'); // The null-terminator
+                               label.data(),                           // The original label
+                               swTraceLabelLength - 1) == 0);          // The length of the label
 
     // SWTrace strings are written in blocks of words, so the offset has to be updated to the next whole word
     offset += OffsetToNextWord(swTraceLabelLength);
 }
 
-void VerifyTimelineEventClassBinaryPacket(ProfilingGuid guid,
-                                          const unsigned char* readableData,
-                                          unsigned int& offset)
+void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid,
+                                              const unsigned char* readableData,
+                                              unsigned int& offset)
 {
     BOOST_ASSERT(readableData);
 
@@ -95,25 +104,7 @@ void VerifyTimelineEventClassBinaryPacket(ProfilingGuid guid,
     unsigned int uint32_t_size = sizeof(uint32_t);
     unsigned int uint64_t_size = sizeof(uint64_t);
 
-    // Check the TimelineEventClassBinaryPacket header
-    uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
-    uint32_t entityBinaryPacketFamily      = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t entityBinaryPacketClass       = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t entityBinaryPacketType        = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
-    uint32_t entityBinaryPacketStreamId    = (entityBinaryPacketHeaderWord0 >>  0) & 0x00000007;
-    BOOST_CHECK(entityBinaryPacketFamily   == 1);
-    BOOST_CHECK(entityBinaryPacketClass    == 0);
-    BOOST_CHECK(entityBinaryPacketType     == 1);
-    BOOST_CHECK(entityBinaryPacketStreamId == 0);
-    offset += uint32_t_size;
-    uint32_t entityBinaryPacketHeaderWord1   = ReadUint32(readableData, offset);
-    uint32_t eventBinaryPacketSequenceNumber = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
-    uint32_t eventBinaryPacketDataLength     = (entityBinaryPacketHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(eventBinaryPacketSequenceNumber == 0);
-    BOOST_CHECK(eventBinaryPacketDataLength     == 12);
-
     // Check the decl id
-    offset += uint32_t_size;
     uint32_t eventClassDeclId = ReadUint32(readableData, offset);
     BOOST_CHECK(eventClassDeclId == 2);
 
@@ -126,7 +117,7 @@ void VerifyTimelineEventClassBinaryPacket(ProfilingGuid guid,
     offset += uint64_t_size;
 }
 
-void VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType relationshipType,
+void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relationshipType,
                                             Optional<ProfilingGuid> relationshipGuid,
                                             Optional<ProfilingGuid> headGuid,
                                             Optional<ProfilingGuid> tailGuid,
@@ -158,25 +149,7 @@ void VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType relationsh
     unsigned int uint32_t_size = sizeof(uint32_t);
     unsigned int uint64_t_size = sizeof(uint64_t);
 
-    // Check the TimelineLabelBinaryPacket header
-    uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
-    uint32_t entityBinaryPacketFamily      = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t entityBinaryPacketClass       = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t entityBinaryPacketType        = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
-    uint32_t entityBinaryPacketStreamId    = (entityBinaryPacketHeaderWord0 >>  0) & 0x00000007;
-    BOOST_CHECK(entityBinaryPacketFamily   == 1);
-    BOOST_CHECK(entityBinaryPacketClass    == 0);
-    BOOST_CHECK(entityBinaryPacketType     == 1);
-    BOOST_CHECK(entityBinaryPacketStreamId == 0);
-    offset += uint32_t_size;
-    uint32_t entityBinaryPacketHeaderWord1   = ReadUint32(readableData, offset);
-    uint32_t eventBinaryPacketSequenceNumber = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
-    uint32_t eventBinaryPacketDataLength     = (entityBinaryPacketHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(eventBinaryPacketSequenceNumber == 0);
-    BOOST_CHECK(eventBinaryPacketDataLength     == 32);
-
     // Check the decl id
-    offset += uint32_t_size;
     uint32_t eventClassDeclId = ReadUint32(readableData, offset);
     BOOST_CHECK(eventClassDeclId == 3);
 
@@ -225,9 +198,9 @@ void VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType relationsh
     offset += uint64_t_size;
 }
 
-void VerifyTimelineEntityBinaryPacket(Optional<ProfilingGuid> guid,
-                                      const unsigned char* readableData,
-                                      unsigned int& offset)
+void VerifyTimelineEntityBinaryPacketData(Optional<ProfilingGuid> guid,
+                                          const unsigned char* readableData,
+                                          unsigned int& offset)
 {
     BOOST_ASSERT(readableData);
 
@@ -236,26 +209,7 @@ void VerifyTimelineEntityBinaryPacket(Optional<ProfilingGuid> guid,
     unsigned int uint64_t_size = sizeof(uint64_t);
 
     // Reading TimelineEntityClassBinaryPacket
-    uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
-    uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
-    uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >>  0) & 0x00000007;
-
-    BOOST_CHECK(entityBinaryPacketFamily == 1);
-    BOOST_CHECK(entityBinaryPacketClass  == 0);
-    BOOST_CHECK(entityBinaryPacketType   == 1);
-    BOOST_CHECK(entityBinaryPacketStreamId     == 0);
-
-    offset += uint32_t_size;
-    uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
-    uint32_t entityBinaryPacketSequenceNumbered = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
-    uint32_t entityBinaryPacketDataLength       = (entityBinaryPacketHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(entityBinaryPacketSequenceNumbered == 0);
-    BOOST_CHECK(entityBinaryPacketDataLength       == 12);
-
     // Check the decl_id
-    offset += uint32_t_size;
     uint32_t entityDeclId = ReadUint32(readableData, offset);
     BOOST_CHECK(entityDeclId == 1);
 
@@ -289,26 +243,7 @@ void VerifyTimelineEventBinaryPacket(Optional<uint64_t> timestamp,
     unsigned int threadId_size = sizeof(std::thread::id);
 
     // Reading TimelineEventBinaryPacket
-    uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(readableData, offset);
-    uint32_t entityBinaryPacketFamily   = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t entityBinaryPacketClass    = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t entityBinaryPacketType     = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
-    uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >>  0) & 0x00000007;
-
-    BOOST_CHECK(entityBinaryPacketFamily   == 1);
-    BOOST_CHECK(entityBinaryPacketClass    == 0);
-    BOOST_CHECK(entityBinaryPacketType     == 1);
-    BOOST_CHECK(entityBinaryPacketStreamId == 0);
-
-    offset += uint32_t_size;
-    uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(readableData, offset);
-    uint32_t entityBinaryPacketSequenceNumbered = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
-    uint32_t entityBinaryPacketDataLength       = (entityBinaryPacketHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(entityBinaryPacketSequenceNumbered == 0);
-    BOOST_CHECK(entityBinaryPacketDataLength       == 20 + threadId_size);
-
     // Check the decl_id
-    offset += uint32_t_size;
     uint32_t entityDeclId = ReadUint32(readableData, offset);
     BOOST_CHECK(entityDeclId == 4);
 
@@ -368,18 +303,18 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
 
     // Convolution details
     TensorInfo inputInfo({ 1, 2, 5, 1 }, DataType::Float32);
-    TensorInfo weightInfo({ 3, 2, 3, 1}, DataType::Float32);
+    TensorInfo weightInfo({ 3, 2, 3, 1 }, DataType::Float32);
     TensorInfo biasInfo({ 3 }, DataType::Float32);
-    TensorInfo outputInfo({ 1, 3, 7, 1}, DataType::Float32);
+    TensorInfo outputInfo({ 1, 3, 7, 1 }, DataType::Float32);
     std::vector<float> weightsData{
-            1.0f,  0.0f,  0.0f,
-            0.0f,  2.0f, -1.5f,
+        1.0f, 0.0f, 0.0f,
+        0.0f, 2.0f, -1.5f,
 
-            0.0f,  0.0f,  0.0f,
-            0.2f,  0.2f,  0.2f,
+        0.0f, 0.0f, 0.0f,
+        0.2f, 0.2f, 0.2f,
 
-            0.5f,  0.0f,  0.5f,
-            0.0f, -1.0f,  0.0f
+        0.5f, 0.0f, 0.5f,
+        0.0f, -1.0f, 0.0f
     };
     ConstTensor weights(weightInfo, weightsData);
 
@@ -393,8 +328,8 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
 
     // Convolution2d layer
     Convolution2dDescriptor conv2dDesc;
-    conv2dDesc.m_StrideX  = 1;
-    conv2dDesc.m_StrideY  = 1;
+    conv2dDesc.m_StrideX = 1;
+    conv2dDesc.m_StrideY = 1;
     conv2dDesc.m_PadLeft = 0;
     conv2dDesc.m_PadRight = 0;
     conv2dDesc.m_PadTop = 2;
@@ -435,386 +370,389 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
     BOOST_CHECK(readableBuffer != nullptr);
 
     unsigned int size = readableBuffer->GetSize();
-    BOOST_CHECK(size == 1980);
+    BOOST_CHECK(size == 1556);
 
     const unsigned char* readableData = readableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     unsigned int offset = 0;
 
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 1548);
+
     // Post-optimisation network
     // Network entity
-    VerifyTimelineEntityBinaryPacket(optNetGuid, readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(optNetGuid, readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Input layer
     // Input layer entity
-    VerifyTimelineEntityBinaryPacket(input->GetGuid(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(input->GetGuid(), readableData, offset);
 
     // Name Entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), "input", readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "input", readableData, offset);
 
     // Entity - Name relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           input->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               input->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Name label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::NAME_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::NAME_GUID,
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           input->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               input->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Network - Input layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           input->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               input->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Conv2d layer
     // Conv2d layer entity
-    VerifyTimelineEntityBinaryPacket(conv2d->GetGuid(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(conv2d->GetGuid(), readableData, offset);
 
     // Name entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), "<Unnamed>", readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "<Unnamed>", readableData, offset);
 
     // Entity - Name relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           conv2d->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               conv2d->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Name label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::NAME_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::NAME_GUID,
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           conv2d->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               conv2d->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Network - Conv2d layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           conv2d->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               conv2d->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Input layer - Conv2d layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           input->GetGuid(),
-                                           conv2d->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               input->GetGuid(),
+                                               conv2d->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::CONNECTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::CONNECTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Conv2d workload
     // Conv2d workload entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // BackendId entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), backendId.Get(), readableData, offset);
 
     // Entity - BackendId relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // BackendId label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::BACKENDID_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::BACKENDID_GUID,
+                                               readableData,
+                                               offset);
 
     // Conv2d layer - Conv2d workload relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           conv2d->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               conv2d->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Activation layer
     // Activation layer entity
-    VerifyTimelineEntityBinaryPacket(activation->GetGuid(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(activation->GetGuid(), readableData, offset);
 
     // Name entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), "activation", readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "activation", readableData, offset);
 
     // Entity - Name relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           activation->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               activation->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Name label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::NAME_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::NAME_GUID,
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           activation->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               activation->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Network - Activation layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           activation->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               activation->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Conv2d layer - Activation layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           conv2d->GetGuid(),
-                                           activation->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               conv2d->GetGuid(),
+                                               activation->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::CONNECTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::CONNECTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Activation workload
     // Activation workload entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // BackendId entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), backendId.Get(), readableData, offset);
 
     // Entity - BackendId relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // BackendId label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::BACKENDID_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::BACKENDID_GUID,
+                                               readableData,
+                                               offset);
 
     // Activation layer - Activation workload relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           activation->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               activation->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Output layer
     // Output layer entity
-    VerifyTimelineEntityBinaryPacket(output->GetGuid(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(output->GetGuid(), readableData, offset);
 
     // Name entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), "output", readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), "output", readableData, offset);
 
     // Entity - Name relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           output->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               output->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Name label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::NAME_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::NAME_GUID,
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           output->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               output->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Network - Output layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           output->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               output->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Activation layer - Output layer relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           activation->GetGuid(),
-                                           output->GetGuid(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               activation->GetGuid(),
+                                               output->GetGuid(),
+                                               readableData,
+                                               offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::CONNECTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::CONNECTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     bufferManager.MarkRead(readableBuffer);
 
@@ -823,13 +761,13 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
     std::vector<float> outputData(outputInfo.GetNumElements());
 
     InputTensors inputTensors
-    {
-        {0, ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputData.data())}
-    };
+        {
+            { 0, ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputData.data()) }
+        };
     OutputTensors outputTensors
-    {
-        {0, Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data())}
-    };
+        {
+            { 0, Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data()) }
+        };
 
     // Does the inference.
     runtime->EnqueueWorkload(netId, inputTensors, outputTensors);
@@ -848,501 +786,510 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
 
     // Validate input workload data
     size = inputReadableBuffer->GetSize();
-    BOOST_CHECK(size == 252);
+    BOOST_CHECK(size == 204);
 
     readableData = inputReadableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     offset = 0;
 
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 196);
+
     // Input workload
     // Input workload entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // BackendId entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), backendId.Get(), readableData, offset);
 
     // Entity - BackendId relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // BackendId label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::BACKENDID_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::BACKENDID_GUID,
+                                               readableData,
+                                               offset);
 
     // Input layer - Input workload relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           input->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               input->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     bufferManager.MarkRead(inputReadableBuffer);
 
     // Validate output workload data
     size = outputReadableBuffer->GetSize();
-    BOOST_CHECK(size == 252);
+    BOOST_CHECK(size == 204);
 
     readableData = outputReadableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     offset = 0;
 
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 196);
+
     // Output workload
     // Output workload entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // BackendId entity
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), backendId.Get(), readableData, offset);
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), backendId.Get(), readableData, offset);
 
     // Entity - BackendId relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // BackendId label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::BACKENDID_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::BACKENDID_GUID,
+                                               readableData,
+                                               offset);
 
     // Output layer - Output workload relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           output->GetGuid(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               output->GetGuid(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     bufferManager.MarkRead(outputReadableBuffer);
 
     // Validate inference data
     size = inferenceReadableBuffer->GetSize();
-    BOOST_CHECK(size == 2020);
+    BOOST_CHECK(size == 1596);
 
     readableData = inferenceReadableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     offset = 0;
 
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 1588);
+
     // Inference timeline trace
     // Inference entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::INFERENCE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::INFERENCE_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Network - Inference relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           optNetGuid,
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               optNetGuid,
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Start Inference life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Inference - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // Execution
     // Input workload execution
     // Input workload execution entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Inference - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Workload - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Start Input workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Input workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // End of Input workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Input workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // Conv2d workload execution
     // Conv2d workload execution entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Inference - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Workload - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Start Conv2d workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Conv2d workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // End of Conv2d workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Conv2d workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // Activation workload execution
     // Activation workload execution entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Inference - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Workload - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Start Activation workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Activation workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // End of Activation workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Activation workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // Output workload execution
     // Output workload execution entity
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
 
     // Entity - Type relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
+                                               readableData,
+                                               offset);
 
     // Type label relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Inference - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Workload - Workload execution relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Start Output workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Output workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // End of Normalize workload execution life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Output workload execution - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     // End of Inference life
     // Event packet - timeline, threadId, eventGuid
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
     // Inference - event relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Event - event class relationship
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
-                                           readableData,
-                                           offset);
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+                                               readableData,
+                                               offset);
 
     bufferManager.MarkRead(inferenceReadableBuffer);
 }
index 7fb5d62..175c9cc 100644 (file)
@@ -18,26 +18,30 @@ using namespace armnn::profiling;
 
 inline 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,
+void VerifyTimelineHeaderBinary(const unsigned char* readableData,
+                                unsigned int& offset,
+                                uint32_t packetDataLength);
+
+void VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid,
+                                         const std::string& label,
+                                         const unsigned char* readableData,
+                                         unsigned int& offset);
+
+void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid,
+                                              const unsigned char* readableData,
+                                              unsigned int& offset);
+
+void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relationshipType,
+                                                Optional<ProfilingGuid> relationshipGuid,
+                                                Optional<ProfilingGuid> headGuid,
+                                                Optional<ProfilingGuid> tailGuid,
+                                                const unsigned char* readableData,
+                                                unsigned int& offset);
+
+void VerifyTimelineEntityBinaryPacketData(Optional<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,
index af15c57..2e64c75 100644 (file)
@@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(SendTimelineMessageDirectoryPackageTest)
     BOOST_CHECK(swTraceMessage.m_ArgNames[2] == "eventGuid");
 }
 
-BOOST_AUTO_TEST_CASE(SendTimelineEntityPlusEventClassBinaryPacketTest)
+BOOST_AUTO_TEST_CASE(SendTimelineEntityWithEventClassPacketTest)
 {
     MockBufferManager bufferManager(40);
     TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
@@ -159,23 +159,26 @@ BOOST_AUTO_TEST_CASE(SendTimelineEntityPlusEventClassBinaryPacketTest)
     unsigned int offset = 0;
 
     // Reading TimelineEntityClassBinaryPacket
-    uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(packetBuffer, offset);
-    uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t entityBinaryPacketClass  = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t entityBinaryPacketType   = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
+    uint32_t entityBinaryPacketHeaderWord0  = ReadUint32(packetBuffer, offset);
+    uint32_t entityBinaryPacketFamily       = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
+    uint32_t entityBinaryPacketClass        = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
+    uint32_t entityBinaryPacketType         = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
     uint32_t entityBinaryPacketStreamId     = (entityBinaryPacketHeaderWord0 >>  0) & 0x00000007;
 
-    BOOST_CHECK(entityBinaryPacketFamily == 1);
-    BOOST_CHECK(entityBinaryPacketClass  == 0);
-    BOOST_CHECK(entityBinaryPacketType   == 1);
+    BOOST_CHECK(entityBinaryPacketFamily       == 1);
+    BOOST_CHECK(entityBinaryPacketClass        == 0);
+    BOOST_CHECK(entityBinaryPacketType         == 1);
     BOOST_CHECK(entityBinaryPacketStreamId     == 0);
 
     offset += uint32_t_size;
-    uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(packetBuffer, offset);
+
+    uint32_t entityBinaryPacketHeaderWord1      = ReadUint32(packetBuffer, offset);
+
     uint32_t entityBinaryPacketSequenceNumbered = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
     uint32_t entityBinaryPacketDataLength       = (entityBinaryPacketHeaderWord1 >>  0) & 0x00FFFFFF;
+
     BOOST_CHECK(entityBinaryPacketSequenceNumbered == 0);
-    BOOST_CHECK(entityBinaryPacketDataLength       == 12);
+    BOOST_CHECK(entityBinaryPacketDataLength       == 24);
 
     // Check the decl_id
     offset += uint32_t_size;
@@ -191,25 +194,7 @@ BOOST_AUTO_TEST_CASE(SendTimelineEntityPlusEventClassBinaryPacketTest)
 
     // Reading TimelineEventClassBinaryPacket
     offset += uint64_t_size;
-    uint32_t eventClassBinaryPacketHeaderWord0 = ReadUint32(packetBuffer, offset);
-    uint32_t eventClassBinaryPacketFamily = (eventClassBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t eventClassBinaryPacketClass  = (eventClassBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t eventClassBinaryPacketType   = (eventClassBinaryPacketHeaderWord0 >> 16) & 0x00000007;
-    uint32_t eventClassBinaryPacketStreamId     = (eventClassBinaryPacketHeaderWord0 >>  0) & 0x00000007;
-
-    BOOST_CHECK(eventClassBinaryPacketFamily == 1);
-    BOOST_CHECK(eventClassBinaryPacketClass  == 0);
-    BOOST_CHECK(eventClassBinaryPacketType   == 1);
-    BOOST_CHECK(eventClassBinaryPacketStreamId     == 0);
 
-    offset += uint32_t_size;
-    uint32_t eventClassBinaryPacketHeaderWord1 = ReadUint32(packetBuffer, offset);
-    uint32_t eventClassBinaryPacketSequenceNumbered = (eventClassBinaryPacketHeaderWord1 >> 24) & 0x00000001;
-    uint32_t eventClassBinaryPacketDataLength       = (eventClassBinaryPacketHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(eventClassBinaryPacketSequenceNumbered == 0);
-    BOOST_CHECK(eventClassBinaryPacketDataLength       == 12);
-
-    offset += uint32_t_size;
     uint32_t eventClassDeclId = ReadUint32(packetBuffer, offset);
     BOOST_CHECK(eventClassDeclId == uint32_t(2));
 
@@ -221,7 +206,7 @@ BOOST_AUTO_TEST_CASE(SendTimelineEntityPlusEventClassBinaryPacketTest)
     bufferManager.MarkRead(packetBuffer);
 }
 
-BOOST_AUTO_TEST_CASE(SendTimelinePacketTests1)
+BOOST_AUTO_TEST_CASE(SendEventClassAfterTimelineEntityPacketTest)
 {
     unsigned int uint32_t_size = sizeof(uint32_t);
     unsigned int uint64_t_size = sizeof(uint64_t);
index 824f055..1d5d451 100644 (file)
@@ -12,7 +12,7 @@ using namespace armnn::profiling;
 
 BOOST_AUTO_TEST_SUITE(TimelinePacketTests)
 
-BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest1)
+BOOST_AUTO_TEST_CASE(TimelineLabelPacketTestNoBuffer)
 {
     const uint64_t profilingGuid = 123456u;
     const std::string label = "some label";
@@ -26,7 +26,7 @@ BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest1)
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest2)
+BOOST_AUTO_TEST_CASE(TimelineLabelPacketTestBufferExhaustionZeroValue)
 {
     std::vector<unsigned char> buffer(512, 0);
 
@@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest2)
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest3)
+BOOST_AUTO_TEST_CASE(TimelineLabelPacketTestBufferExhaustionFixedValue)
 {
     std::vector<unsigned char> buffer(10, 0);
 
@@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest3)
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest4)
+BOOST_AUTO_TEST_CASE(TimelineLabelPacketTestInvalidLabel)
 {
     std::vector<unsigned char> buffer(512, 0);
 
@@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest4)
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest5)
+BOOST_AUTO_TEST_CASE(TimelineLabelPacketTestSingleConstructionOfData)
 {
     std::vector<unsigned char> buffer(512, 0);
 
@@ -87,32 +87,13 @@ BOOST_AUTO_TEST_CASE(TimelineLabelPacketTest5)
                                                                  boost::numeric_cast<unsigned int>(buffer.size()),
                                                                  numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::Ok);
-    BOOST_CHECK(numberOfBytesWritten == 36);
+    BOOST_CHECK(numberOfBytesWritten == 28);
 
     unsigned int uint32_t_size = sizeof(uint32_t);
     unsigned int uint64_t_size = sizeof(uint64_t);
 
     // Check the packet header
     unsigned int offset = 0;
-    uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset);
-    uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t packetClass  = (packetHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t packetType   = (packetHeaderWord0 >> 16) & 0x00000007;
-    uint32_t streamId     = (packetHeaderWord0 >>  0) & 0x00000007;
-    BOOST_CHECK(packetFamily == 1);
-    BOOST_CHECK(packetClass  == 0);
-    BOOST_CHECK(packetType   == 1);
-    BOOST_CHECK(streamId     == 0);
-
-    offset += uint32_t_size;
-    uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset);
-    uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001;
-    uint32_t dataLength       = (packetHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(sequenceNumbered ==  0);
-    BOOST_CHECK(dataLength       == 28);
-
-    // Check decl_Id
-    offset += uint32_t_size;
     uint32_t decl_Id = ReadUint32(buffer.data(), offset);
     BOOST_CHECK(decl_Id == uint32_t(0));
 
@@ -142,13 +123,13 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketNullBufferTest)
     const uint64_t headGuid = 234567u;
     const uint64_t tailGuid = 345678u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineRelationshipBinaryPacket(relationshipType,
-                                                                        relationshipGuid,
-                                                                        headGuid,
-                                                                        tailGuid,
-                                                                        nullptr,
-                                                                        512u,
-                                                                        numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineRelationshipBinary(relationshipType,
+                                                                  relationshipGuid,
+                                                                  headGuid,
+                                                                  tailGuid,
+                                                                  nullptr,
+                                                                  512u,
+                                                                  numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
@@ -162,13 +143,13 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketZeroBufferSizeTest)
     const uint64_t headGuid = 234567u;
     const uint64_t tailGuid = 345678u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineRelationshipBinaryPacket(relationshipType,
-                                                                        relationshipGuid,
-                                                                        headGuid,
-                                                                        tailGuid,
-                                                                        buffer.data(),
-                                                                        0,
-                                                                        numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineRelationshipBinary(relationshipType,
+                                                                  relationshipGuid,
+                                                                  headGuid,
+                                                                  tailGuid,
+                                                                  buffer.data(),
+                                                                  0,
+                                                                  numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
@@ -183,13 +164,13 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketSmallBufferSizeTest)
     const uint64_t tailGuid = 345678u;
     unsigned int numberOfBytesWritten = 789u;
     TimelinePacketStatus result =
-        WriteTimelineRelationshipBinaryPacket(relationshipType,
-                                              relationshipGuid,
-                                              headGuid,
-                                              tailGuid,
-                                              buffer.data(),
-                                              boost::numeric_cast<unsigned int>(buffer.size()),
-                                              numberOfBytesWritten);
+                             WriteTimelineRelationshipBinary(relationshipType,
+                                                             relationshipGuid,
+                                                             headGuid,
+                                                             tailGuid,
+                                                             buffer.data(),
+                                                             boost::numeric_cast<unsigned int>(buffer.size()),
+                                                             numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
@@ -203,19 +184,19 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketInvalidRelationTest)
     const uint64_t tailGuid = 345678u;
     unsigned int numberOfBytesWritten = 789u;
 
-    BOOST_CHECK_THROW(WriteTimelineRelationshipBinaryPacket(relationshipType,
-                                                            relationshipGuid,
-                                                            headGuid,
-                                                            tailGuid,
-                                                            buffer.data(),
-                                                            boost::numeric_cast<unsigned int>(buffer.size()),
-                                                            numberOfBytesWritten),
-                       armnn::InvalidArgumentException);
+    BOOST_CHECK_THROW(WriteTimelineRelationshipBinary(relationshipType,
+                                                      relationshipGuid,
+                                                      headGuid,
+                                                      tailGuid,
+                                                      buffer.data(),
+                                                      boost::numeric_cast<unsigned int>(buffer.size()),
+                                                      numberOfBytesWritten),
+                      armnn::InvalidArgumentException);
 
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketTest)
+BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketTestDataConstruction)
 {
     std::vector<unsigned char> buffer(512, 0);
 
@@ -225,40 +206,22 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketTest)
     const uint64_t tailGuid = 345678u;
     unsigned int numberOfBytesWritten = 789u;
     TimelinePacketStatus result =
-        WriteTimelineRelationshipBinaryPacket(relationshipType,
-                                              relationshipGuid,
-                                              headGuid,
-                                              tailGuid,
-                                              buffer.data(),
-                                              boost::numeric_cast<unsigned int>(buffer.size()),
-                                              numberOfBytesWritten);
+                             WriteTimelineRelationshipBinary(relationshipType,
+                                                             relationshipGuid,
+                                                             headGuid,
+                                                             tailGuid,
+                                                             buffer.data(),
+                                                             boost::numeric_cast<unsigned int>(buffer.size()),
+                                                             numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::Ok);
-    BOOST_CHECK(numberOfBytesWritten == 40);
+    BOOST_CHECK(numberOfBytesWritten == 32);
 
     unsigned int uint32_t_size = sizeof(uint32_t);
     unsigned int uint64_t_size = sizeof(uint64_t);
 
     // Check the packet header
     unsigned int offset = 0;
-    uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset);
-    uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t packetClass  = (packetHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t packetType   = (packetHeaderWord0 >> 16) & 0x00000007;
-    uint32_t streamId     = (packetHeaderWord0 >>  0) & 0x00000007;
-    BOOST_CHECK(packetFamily == 1);
-    BOOST_CHECK(packetClass  == 0);
-    BOOST_CHECK(packetType   == 1);
-    BOOST_CHECK(streamId     == 0);
-
-    offset += uint32_t_size;
-    uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset);
-    uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001;
-    uint32_t dataLength       = (packetHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(sequenceNumbered ==  0);
-    BOOST_CHECK(dataLength       == 32);
-
     // Check the decl_id
-    offset += uint32_t_size;
     uint32_t readDeclId = ReadUint32(buffer.data(), offset);
     BOOST_CHECK(readDeclId == 3);
 
@@ -283,7 +246,7 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketTest)
     BOOST_CHECK(readTailGuid == tailGuid);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketExecutionLinkTest)
+BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketExecutionLinkTestDataConstruction)
 {
     std::vector<unsigned char> buffer(512, 0);
 
@@ -293,40 +256,20 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketExecutionLinkTest)
     const uint64_t tailGuid = 345678u;
     unsigned int numberOfBytesWritten = 789u;
     TimelinePacketStatus result =
-        WriteTimelineRelationshipBinaryPacket(relationshipType,
-                                              relationshipGuid,
-                                              headGuid,
-                                              tailGuid,
-                                              buffer.data(),
-                                              boost::numeric_cast<unsigned int>(buffer.size()),
-                                              numberOfBytesWritten);
+                             WriteTimelineRelationshipBinary(relationshipType,
+                                                             relationshipGuid,
+                                                             headGuid,
+                                                             tailGuid,
+                                                             buffer.data(),
+                                                             boost::numeric_cast<unsigned int>(buffer.size()),
+                                                             numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::Ok);
-    BOOST_CHECK(numberOfBytesWritten == 40);
+    BOOST_CHECK(numberOfBytesWritten == 32);
 
     unsigned int uint32_t_size = sizeof(uint32_t);
     unsigned int uint64_t_size = sizeof(uint64_t);
 
-    // Check the packet header
     unsigned int offset = 0;
-    uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset);
-    uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t packetClass  = (packetHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t packetType   = (packetHeaderWord0 >> 16) & 0x00000007;
-    uint32_t streamId     = (packetHeaderWord0 >>  0) & 0x00000007;
-    BOOST_CHECK(packetFamily == 1);
-    BOOST_CHECK(packetClass  == 0);
-    BOOST_CHECK(packetType   == 1);
-    BOOST_CHECK(streamId     == 0);
-
-    offset += uint32_t_size;
-    uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset);
-    uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001;
-    uint32_t dataLength       = (packetHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(sequenceNumbered ==  0);
-    BOOST_CHECK(dataLength       == 32);
-
-    // Check the decl_id
-    offset += uint32_t_size;
     uint32_t readDeclId = ReadUint32(buffer.data(), offset);
     BOOST_CHECK(readDeclId == 3);
 
@@ -352,7 +295,7 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketExecutionLinkTest)
 }
 
 
-BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketDataLinkTest)
+BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketDataLinkTestDataConstruction)
 {
     std::vector<unsigned char> buffer(512, 0);
 
@@ -362,40 +305,20 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketDataLinkTest)
     const uint64_t tailGuid = 345678u;
     unsigned int numberOfBytesWritten = 789u;
     TimelinePacketStatus result =
-        WriteTimelineRelationshipBinaryPacket(relationshipType,
-                                              relationshipGuid,
-                                              headGuid,
-                                              tailGuid,
-                                              buffer.data(),
-                                              boost::numeric_cast<unsigned int>(buffer.size()),
-                                              numberOfBytesWritten);
+                             WriteTimelineRelationshipBinary(relationshipType,
+                                                             relationshipGuid,
+                                                             headGuid,
+                                                             tailGuid,
+                                                             buffer.data(),
+                                                             boost::numeric_cast<unsigned int>(buffer.size()),
+                                                             numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::Ok);
-    BOOST_CHECK(numberOfBytesWritten == 40);
+    BOOST_CHECK(numberOfBytesWritten == 32);
 
     unsigned int uint32_t_size = sizeof(uint32_t);
     unsigned int uint64_t_size = sizeof(uint64_t);
 
-    // Check the packet header
     unsigned int offset = 0;
-    uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset);
-    uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t packetClass  = (packetHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t packetType   = (packetHeaderWord0 >> 16) & 0x00000007;
-    uint32_t streamId     = (packetHeaderWord0 >>  0) & 0x00000007;
-    BOOST_CHECK(packetFamily == 1);
-    BOOST_CHECK(packetClass  == 0);
-    BOOST_CHECK(packetType   == 1);
-    BOOST_CHECK(streamId     == 0);
-
-    offset += uint32_t_size;
-    uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset);
-    uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001;
-    uint32_t dataLength       = (packetHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(sequenceNumbered ==  0);
-    BOOST_CHECK(dataLength       == 32);
-
-    // Check the decl_id
-    offset += uint32_t_size;
     uint32_t readDeclId = ReadUint32(buffer.data(), offset);
     BOOST_CHECK(readDeclId == 3);
 
@@ -421,7 +344,7 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketDataLinkTest)
 }
 
 
-BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketLabelLinkTest)
+BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketLabelLinkTestDataConstruction)
 {
     std::vector<unsigned char> buffer(512, 0);
 
@@ -431,40 +354,21 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketLabelLinkTest)
     const uint64_t tailGuid = 345678u;
     unsigned int numberOfBytesWritten = 789u;
     TimelinePacketStatus result =
-        WriteTimelineRelationshipBinaryPacket(relationshipType,
-                                              relationshipGuid,
-                                              headGuid,
-                                              tailGuid,
-                                              buffer.data(),
-                                              boost::numeric_cast<unsigned int>(buffer.size()),
-                                              numberOfBytesWritten);
+                             WriteTimelineRelationshipBinary(relationshipType,
+                                                             relationshipGuid,
+                                                             headGuid,
+                                                             tailGuid,
+                                                             buffer.data(),
+                                                             boost::numeric_cast<unsigned int>(buffer.size()),
+                                                             numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::Ok);
-    BOOST_CHECK(numberOfBytesWritten == 40);
+    BOOST_CHECK(numberOfBytesWritten == 32);
 
     unsigned int uint32_t_size = sizeof(uint32_t);
     unsigned int uint64_t_size = sizeof(uint64_t);
 
     // Check the packet header
     unsigned int offset = 0;
-    uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset);
-    uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t packetClass  = (packetHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t packetType   = (packetHeaderWord0 >> 16) & 0x00000007;
-    uint32_t streamId     = (packetHeaderWord0 >>  0) & 0x00000007;
-    BOOST_CHECK(packetFamily == 1);
-    BOOST_CHECK(packetClass  == 0);
-    BOOST_CHECK(packetType   == 1);
-    BOOST_CHECK(streamId     == 0);
-
-    offset += uint32_t_size;
-    uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset);
-    uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001;
-    uint32_t dataLength       = (packetHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(sequenceNumbered ==  0);
-    BOOST_CHECK(dataLength       == 32);
-
-    // Check the decl_id
-    offset += uint32_t_size;
     uint32_t readDeclId = ReadUint32(buffer.data(), offset);
     BOOST_CHECK(readDeclId == 3);
 
@@ -489,7 +393,7 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketLabelLinkTest)
     BOOST_CHECK(readTailGuid == tailGuid);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTest1)
+BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestNoBuffer)
 {
     unsigned int numberOfBytesWritten = 789u;
     TimelinePacketStatus result = WriteTimelineMessageDirectoryPackage(nullptr,
@@ -499,7 +403,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTest1)
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTest2)
+BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestBufferExhausted)
 {
     std::vector<unsigned char> buffer(512, 0);
 
@@ -511,7 +415,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTest2)
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTest3)
+BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestFullConstruction)
 {
     std::vector<unsigned char> buffer(512, 0);
     unsigned int numberOfBytesWritten = 789u;
@@ -636,82 +540,63 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTest3)
                             swTraceDeclNameLength - 1) == 0); // The length of the label
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEntityPacketTest1)
+BOOST_AUTO_TEST_CASE(TimelineEntityPacketTestNoBuffer)
 {
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEntityBinaryPacket(profilingGuid,
-                                                                 nullptr,
-                                                                 512u,
-                                                                 numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEntityBinary(profilingGuid,
+                                                            nullptr,
+                                                            512u,
+                                                            numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEntityPacketTest2)
+BOOST_AUTO_TEST_CASE(TimelineEntityPacketTestBufferExhaustedWithZeroBufferSize)
 {
     std::vector<unsigned char> buffer(512, 0);
 
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEntityBinaryPacket(profilingGuid,
-                                                                 buffer.data(),
-                                                                 0,
-                                                                 numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEntityBinary(profilingGuid,
+                                                            buffer.data(),
+                                                            0,
+                                                            numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEntityPacketTest3)
+BOOST_AUTO_TEST_CASE(TimelineEntityPacketTestBufferExhaustedWithFixedBufferSize)
 {
     std::vector<unsigned char> buffer(10, 0);
 
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEntityBinaryPacket(profilingGuid,
-                                                                 buffer.data(),
-                                                                 boost::numeric_cast<unsigned int>(buffer.size()),
-                                                                 numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEntityBinary(profilingGuid,
+                                                            buffer.data(),
+                                                            boost::numeric_cast<unsigned int>(buffer.size()),
+                                                            numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEntityPacketTest4)
+BOOST_AUTO_TEST_CASE(TimelineEntityPacketTestFullConstructionOfData)
 {
     std::vector<unsigned char> buffer(512, 0);
 
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEntityBinaryPacket(profilingGuid,
-                                                                 buffer.data(),
-                                                                 boost::numeric_cast<unsigned int>(buffer.size()),
-                                                                 numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEntityBinary(profilingGuid,
+                                                            buffer.data(),
+                                                            boost::numeric_cast<unsigned int>(buffer.size()),
+                                                            numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::Ok);
-    BOOST_CHECK(numberOfBytesWritten == 20);
+    BOOST_CHECK(numberOfBytesWritten == 12);
 
     unsigned int uint32_t_size = sizeof(uint32_t);
 
-    // Check the packet header
     unsigned int offset = 0;
-    uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset);
-    uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t packetClass  = (packetHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t packetType   = (packetHeaderWord0 >> 16) & 0x00000007;
-    uint32_t streamId     = (packetHeaderWord0 >>  0) & 0x00000007;
-    BOOST_CHECK(packetFamily == 1);
-    BOOST_CHECK(packetClass  == 0);
-    BOOST_CHECK(packetType   == 1);
-    BOOST_CHECK(streamId     == 0);
-
-    offset += uint32_t_size;
-    uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset);
-    uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001;
-    uint32_t dataLength       = (packetHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(sequenceNumbered ==  0);
-    BOOST_CHECK(dataLength       == 12);
-
     // Check decl_Id
-    offset += uint32_t_size;
     uint32_t decl_Id = ReadUint32(buffer.data(), offset);
     BOOST_CHECK(decl_Id == uint32_t(1));
 
@@ -721,82 +606,63 @@ BOOST_AUTO_TEST_CASE(TimelineEntityPacketTest4)
     BOOST_CHECK(readProfilingGuid == profilingGuid);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEventClassTest1)
+BOOST_AUTO_TEST_CASE(TimelineEventClassTestNoBuffer)
 {
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEventClassBinaryPacket(profilingGuid,
-                                                                      nullptr,
-                                                                      512u,
-                                                                      numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEventClassBinary(profilingGuid,
+                                                                nullptr,
+                                                                512u,
+                                                                numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEventClassTest2)
+BOOST_AUTO_TEST_CASE(TimelineEventClassTestBufferExhaustionZeroValue)
 {
     std::vector<unsigned char> buffer(512, 0);
 
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEventClassBinaryPacket(profilingGuid,
-                                                                      buffer.data(),
-                                                                      0,
-                                                                      numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEventClassBinary(profilingGuid,
+                                                                buffer.data(),
+                                                                0,
+                                                                numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEventClassTest3)
+BOOST_AUTO_TEST_CASE(TimelineEventClassTestBufferExhaustionFixedValue)
 {
     std::vector<unsigned char> buffer(10, 0);
 
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEventClassBinaryPacket(profilingGuid,
-                                                                      buffer.data(),
-                                                                      boost::numeric_cast<unsigned int>(buffer.size()),
-                                                                      numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEventClassBinary(profilingGuid,
+                                                                buffer.data(),
+                                                                boost::numeric_cast<unsigned int>(buffer.size()),
+                                                                numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEventClassTest4)
+BOOST_AUTO_TEST_CASE(TimelineEventClassTestFullConstructionOfData)
 {
     std::vector<unsigned char> buffer(512, 0);
 
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEventClassBinaryPacket(profilingGuid,
-                                                                      buffer.data(),
-                                                                      boost::numeric_cast<unsigned int>(buffer.size()),
-                                                                      numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEventClassBinary(profilingGuid,
+                                                                buffer.data(),
+                                                                boost::numeric_cast<unsigned int>(buffer.size()),
+                                                                numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::Ok);
-    BOOST_CHECK(numberOfBytesWritten == 20);
+    BOOST_CHECK(numberOfBytesWritten == 12);
 
     unsigned int uint32_t_size = sizeof(uint32_t);
 
-    // Check the packet header
     unsigned int offset = 0;
-    uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset);
-    uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t packetClass  = (packetHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t packetType   = (packetHeaderWord0 >> 16) & 0x00000007;
-    uint32_t streamId     = (packetHeaderWord0 >>  0) & 0x00000007;
-    BOOST_CHECK(packetFamily == 1);
-    BOOST_CHECK(packetClass  == 0);
-    BOOST_CHECK(packetType   == 1);
-    BOOST_CHECK(streamId     == 0);
-
-    offset += uint32_t_size;
-    uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset);
-    uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001;
-    uint32_t dataLength       = (packetHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(sequenceNumbered ==  0);
-    BOOST_CHECK(dataLength       == 12);
-
     // Check the decl_id
-    offset += uint32_t_size;
     uint32_t declId = ReadUint32(buffer.data(), offset);
     BOOST_CHECK(declId == uint32_t(2));
 
@@ -806,23 +672,23 @@ BOOST_AUTO_TEST_CASE(TimelineEventClassTest4)
     BOOST_CHECK(readProfilingGuid == profilingGuid);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEventPacketTest1)
+BOOST_AUTO_TEST_CASE(TimelineEventPacketTestNoBuffer)
 {
     const uint64_t timestamp = 456789u;
     const std::thread::id threadId = std::this_thread::get_id();
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEventBinaryPacket(timestamp,
-                                                                 threadId,
-                                                                 profilingGuid,
-                                                                 nullptr,
-                                                                 512u,
-                                                                 numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEventBinary(timestamp,
+                                                           threadId,
+                                                           profilingGuid,
+                                                           nullptr,
+                                                           512u,
+                                                           numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEventPacketTest2)
+BOOST_AUTO_TEST_CASE(TimelineEventPacketTestBufferExhaustionZeroValue)
 {
     std::vector<unsigned char> buffer(512, 0);
 
@@ -830,17 +696,17 @@ BOOST_AUTO_TEST_CASE(TimelineEventPacketTest2)
     const std::thread::id threadId = std::this_thread::get_id();
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEventBinaryPacket(timestamp,
-                                                                 threadId,
-                                                                 profilingGuid,
-                                                                 buffer.data(),
-                                                                 0,
-                                                                 numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEventBinary(timestamp,
+                                                           threadId,
+                                                           profilingGuid,
+                                                           buffer.data(),
+                                                           0,
+                                                           numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEventPacketTest3)
+BOOST_AUTO_TEST_CASE(TimelineEventPacketTestBufferExhaustionFixedValue)
 {
     std::vector<unsigned char> buffer(10, 0);
 
@@ -848,17 +714,17 @@ BOOST_AUTO_TEST_CASE(TimelineEventPacketTest3)
     const std::thread::id threadId = std::this_thread::get_id();
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEventBinaryPacket(timestamp,
-                                                                 threadId,
-                                                                 profilingGuid,
-                                                                 buffer.data(),
-                                                                 boost::numeric_cast<unsigned int>(buffer.size()),
-                                                                 numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEventBinary(timestamp,
+                                                           threadId,
+                                                           profilingGuid,
+                                                           buffer.data(),
+                                                           boost::numeric_cast<unsigned int>(buffer.size()),
+                                                           numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
     BOOST_CHECK(numberOfBytesWritten == 0);
 }
 
-BOOST_AUTO_TEST_CASE(TimelineEventPacketTest4)
+BOOST_AUTO_TEST_CASE(TimelineEventPacketTestFullConstructionOfData)
 {
     std::vector<unsigned char> buffer(512, 0);
 
@@ -866,40 +732,21 @@ BOOST_AUTO_TEST_CASE(TimelineEventPacketTest4)
     const std::thread::id threadId = std::this_thread::get_id();
     const uint64_t profilingGuid = 123456u;
     unsigned int numberOfBytesWritten = 789u;
-    TimelinePacketStatus result = WriteTimelineEventBinaryPacket(timestamp,
-                                                                 threadId,
-                                                                 profilingGuid,
-                                                                 buffer.data(),
-                                                                 boost::numeric_cast<unsigned int>(buffer.size()),
-                                                                 numberOfBytesWritten);
+    TimelinePacketStatus result = WriteTimelineEventBinary(timestamp,
+                                                           threadId,
+                                                           profilingGuid,
+                                                           buffer.data(),
+                                                           boost::numeric_cast<unsigned int>(buffer.size()),
+                                                           numberOfBytesWritten);
     BOOST_CHECK(result == TimelinePacketStatus::Ok);
-    BOOST_CHECK(numberOfBytesWritten == 36);
+    BOOST_CHECK(numberOfBytesWritten == 28);
 
     unsigned int uint32_t_size = sizeof(uint32_t);
     unsigned int uint64_t_size = sizeof(uint64_t);
     unsigned int threadId_size = sizeof(std::thread::id);
 
-    // Check the packet header
     unsigned int offset = 0;
-    uint32_t packetHeaderWord0 = ReadUint32(buffer.data(), offset);
-    uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F;
-    uint32_t packetClass  = (packetHeaderWord0 >> 19) & 0x0000007F;
-    uint32_t packetType   = (packetHeaderWord0 >> 16) & 0x00000007;
-    uint32_t streamId     = (packetHeaderWord0 >>  0) & 0x00000007;
-    BOOST_CHECK(packetFamily == 1);
-    BOOST_CHECK(packetClass  == 0);
-    BOOST_CHECK(packetType   == 1);
-    BOOST_CHECK(streamId     == 0);
-
-    offset += uint32_t_size;
-    uint32_t packetHeaderWord1 = ReadUint32(buffer.data(), offset);
-    uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001;
-    uint32_t dataLength       = (packetHeaderWord1 >>  0) & 0x00FFFFFF;
-    BOOST_CHECK(sequenceNumbered ==  0);
-    BOOST_CHECK(dataLength       == 28);
-
     // Check the decl_id
-    offset += uint32_t_size;
     uint32_t readDeclId = ReadUint32(buffer.data(), offset);
     BOOST_CHECK(readDeclId == 4);
 
index efceff2..fed31c3 100644 (file)
@@ -42,31 +42,34 @@ BOOST_AUTO_TEST_CASE(CreateTypedLabelTest)
     auto readableBuffer = mockBufferManager.GetReadableBuffer();
     BOOST_CHECK(readableBuffer != nullptr);
     unsigned int size = readableBuffer->GetSize();
-    BOOST_CHECK(size == 116);
+    BOOST_CHECK(size == 100);
     const unsigned char* readableData = readableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     // Utils
     unsigned int offset = 0;
 
-    // First packet sent: TimelineLabelBinaryPacket
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), entityName, readableData, offset);
-
-    // Second packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           entityGuid,
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
-
-    // Third packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           labelTypeGuid,
-                                           readableData,
-                                           offset);
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 92);
+
+    // First dataset sent: TimelineLabelBinaryPacket
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), entityName, readableData, offset);
+
+    // Second dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               entityGuid,
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
+
+    // Third dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               labelTypeGuid,
+                                               readableData,
+                                               offset);
 
     // Mark the buffer as read
     mockBufferManager.MarkRead(readableBuffer);
@@ -87,81 +90,86 @@ BOOST_AUTO_TEST_CASE(SendWellKnownLabelsAndEventClassesTest)
     auto readableBuffer = mockBufferManager.GetReadableBuffer();
     BOOST_CHECK(readableBuffer != nullptr);
     unsigned int size = readableBuffer->GetSize();
-    BOOST_TEST(size == 388);
+    BOOST_TEST(size == 300);
     const unsigned char* readableData = readableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     // Utils
     unsigned int offset = 0;
 
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 292);
+
     // First "well-known" label: NAME
-    VerifyTimelineLabelBinaryPacket(LabelsAndEventClasses::NAME_GUID,
-                                    LabelsAndEventClasses::NAME_LABEL,
-                                    readableData,
-                                    offset);
+    VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::NAME_GUID,
+                                        LabelsAndEventClasses::NAME_LABEL,
+                                        readableData,
+                                        offset);
 
     // Second "well-known" label: TYPE
-    VerifyTimelineLabelBinaryPacket(LabelsAndEventClasses::TYPE_GUID,
-                                    LabelsAndEventClasses::TYPE_LABEL,
-                                    readableData,
-                                    offset);
+    VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::TYPE_GUID,
+                                        LabelsAndEventClasses::TYPE_LABEL,
+                                        readableData,
+                                        offset);
 
     // Third "well-known" label: INDEX
-    VerifyTimelineLabelBinaryPacket(LabelsAndEventClasses::INDEX_GUID,
-                                    LabelsAndEventClasses::INDEX_LABEL,
-                                    readableData,
-                                    offset);
+    VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::INDEX_GUID,
+                                        LabelsAndEventClasses::INDEX_LABEL,
+                                        readableData,
+                                        offset);
 
     // Forth "well-known" label: BACKENDID
-    VerifyTimelineLabelBinaryPacket(LabelsAndEventClasses::BACKENDID_GUID,
-                                    LabelsAndEventClasses::BACKENDID_LABEL,
-                                    readableData,
-                                    offset);
+    VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::BACKENDID_GUID,
+                                        LabelsAndEventClasses::BACKENDID_LABEL,
+                                        readableData,
+                                        offset);
 
     // Well-known types
     // Layer
-    VerifyTimelineLabelBinaryPacket(LabelsAndEventClasses::LAYER_GUID,
-                                    LabelsAndEventClasses::LAYER,
-                                    readableData,
-                                    offset);
+    VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::LAYER_GUID,
+                                        LabelsAndEventClasses::LAYER,
+                                        readableData,
+                                        offset);
 
     // Workload
-    VerifyTimelineLabelBinaryPacket(LabelsAndEventClasses::WORKLOAD_GUID,
-                                    LabelsAndEventClasses::WORKLOAD,
-                                    readableData,
-                                    offset);
+    VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::WORKLOAD_GUID,
+                                        LabelsAndEventClasses::WORKLOAD,
+                                        readableData,
+                                        offset);
 
     // Network
-    VerifyTimelineLabelBinaryPacket(LabelsAndEventClasses::NETWORK_GUID,
-                                    LabelsAndEventClasses::NETWORK,
-                                    readableData,
-                                    offset);
+    VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::NETWORK_GUID,
+                                        LabelsAndEventClasses::NETWORK,
+                                        readableData,
+                                        offset);
 
     // Connection
-    VerifyTimelineLabelBinaryPacket(LabelsAndEventClasses::CONNECTION_GUID,
-                                    LabelsAndEventClasses::CONNECTION,
-                                    readableData,
-                                    offset);
+    VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::CONNECTION_GUID,
+                                        LabelsAndEventClasses::CONNECTION,
+                                        readableData,
+                                        offset);
+
     // Inference
-    VerifyTimelineLabelBinaryPacket(LabelsAndEventClasses::INFERENCE_GUID,
-                                    LabelsAndEventClasses::INFERENCE,
-                                    readableData,
-                                    offset);
+    VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::INFERENCE_GUID,
+                                        LabelsAndEventClasses::INFERENCE,
+                                        readableData,
+                                        offset);
+
     // Workload Execution
-    VerifyTimelineLabelBinaryPacket(LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
-                                    LabelsAndEventClasses::WORKLOAD_EXECUTION,
-                                    readableData,
-                                    offset);
+    VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
+                                        LabelsAndEventClasses::WORKLOAD_EXECUTION,
+                                        readableData,
+                                        offset);
 
     // First "well-known" event class: START OF LIFE
-    VerifyTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
-                                         readableData,
-                                         offset);
+    VerifyTimelineEventClassBinaryPacketData(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+                                             readableData,
+                                             offset);
 
     // Second "well-known" event class: END OF LIFE
-    VerifyTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
-                                         readableData,
-                                         offset);
+    VerifyTimelineEventClassBinaryPacketData(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+                                             readableData,
+                                             offset);
 
     // Mark the buffer as read
     mockBufferManager.MarkRead(readableBuffer);
@@ -202,61 +210,64 @@ BOOST_AUTO_TEST_CASE(CreateNamedTypedChildEntityTest)
     auto readableBuffer = mockBufferManager.GetReadableBuffer();
     BOOST_CHECK(readableBuffer != nullptr);
     unsigned int size = readableBuffer->GetSize();
-    BOOST_CHECK(size == 292);
+    BOOST_CHECK(size == 236);
     const unsigned char* readableData = readableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     // Utils
     unsigned int offset = 0;
 
-    // First packet sent: TimelineEntityBinaryPacket
-    VerifyTimelineEntityBinaryPacket(EmptyOptional(), readableData, offset);
-
-    // Second packet sent: TimelineLabelBinaryPacket
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), entityName, readableData, offset);
-
-    // Third packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
-
-    // Fourth packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::NAME_GUID,
-                                           readableData,
-                                           offset);
-
-    // Fifth packet sent: TimelineLabelBinaryPacket
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), entityType, readableData, offset);
-
-    // Sixth packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
-
-    // Seventh packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
-
-    // Eighth packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
-                                           EmptyOptional(),
-                                           parentEntityGuid,
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 228);
+
+    // First dataset sent: TimelineEntityBinaryPacket
+    VerifyTimelineEntityBinaryPacketData(EmptyOptional(), readableData, offset);
+
+    // Second dataset sent: TimelineLabelBinaryPacket
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), entityName, readableData, offset);
+
+    // Third dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
+
+    // Fourth dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::NAME_GUID,
+                                               readableData,
+                                               offset);
+
+    // Fifth dataset sent: TimelineLabelBinaryPacket
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), entityType, readableData, offset);
+
+    // Sixth dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
+
+    // Seventh dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
+
+    // Eighth dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::RetentionLink,
+                                               EmptyOptional(),
+                                               parentEntityGuid,
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
 
     // Mark the buffer as read
     mockBufferManager.MarkRead(readableBuffer);
@@ -336,55 +347,58 @@ BOOST_AUTO_TEST_CASE(CreateNameTypeEntityTest)
     auto readableBuffer = mockBufferManager.GetReadableBuffer();
     BOOST_CHECK(readableBuffer != nullptr);
     unsigned int size = readableBuffer->GetSize();
-    BOOST_CHECK(size == 244);
+    BOOST_CHECK(size == 196);
     const unsigned char* readableData = readableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     // Utils
     unsigned int offset = 0;
 
-    // First packet sent: TimelineEntityBinaryPacket
-    VerifyTimelineEntityBinaryPacket(guid, readableData, offset);
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 188);
+
+    // First dataset sent: TimelineEntityBinaryPacket
+    VerifyTimelineEntityBinaryPacketData(guid, readableData, offset);
 
     // Packets for Name Entity
-    // First packet sent: TimelineLabelBinaryPacket
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), entityName, readableData, offset);
-
-    // Second packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
-
-    // Third packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::NAME_GUID,
-                                           readableData,
-                                           offset);
+    // First dataset sent: TimelineLabelBinaryPacket
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), entityName, readableData, offset);
+
+    // Second dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
+
+    // Third dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::NAME_GUID,
+                                               readableData,
+                                               offset);
 
     // Packets for Type Entity
-    // First packet sent: TimelineLabelBinaryPacket
-    VerifyTimelineLabelBinaryPacket(EmptyOptional(), entityType, readableData, offset);
-
-    // Second packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
-
-    // Third packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
-                                           EmptyOptional(),
-                                           EmptyOptional(),
-                                           LabelsAndEventClasses::TYPE_GUID,
-                                           readableData,
-                                           offset);
+    // First dataset sent: TimelineLabelBinaryPacket
+    VerifyTimelineLabelBinaryPacketData(EmptyOptional(), entityType, readableData, offset);
+
+    // Second dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
+
+    // Third dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::LabelLink,
+                                               EmptyOptional(),
+                                               EmptyOptional(),
+                                               LabelsAndEventClasses::TYPE_GUID,
+                                               readableData,
+                                               offset);
 
     // Mark the buffer as read
     mockBufferManager.MarkRead(readableBuffer);
@@ -411,31 +425,34 @@ BOOST_AUTO_TEST_CASE(RecordEventTest)
     auto readableBuffer = mockBufferManager.GetReadableBuffer();
     BOOST_CHECK(readableBuffer != nullptr);
     unsigned int size = readableBuffer->GetSize();
-    BOOST_CHECK(size == 116);
+    BOOST_CHECK(size == 100);
     const unsigned char* readableData = readableBuffer->GetReadableData();
     BOOST_CHECK(readableData != nullptr);
 
     // Utils
     unsigned int offset = 0;
 
-    // First packet sent: TimelineEntityBinaryPacket
+    // Verify Header
+    VerifyTimelineHeaderBinary(readableData, offset, 92);
+
+    // First dataset sent: TimelineEntityBinaryPacket
     VerifyTimelineEventBinaryPacket(EmptyOptional(), EmptyOptional(), EmptyOptional(), readableData, offset);
 
-    // Second packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
-                                           EmptyOptional(),
-                                           entityGuid,
-                                           EmptyOptional(),
-                                           readableData,
-                                           offset);
-
-    // Third packet sent: TimelineRelationshipBinaryPacket
-    VerifyTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
-                                           EmptyOptional(),
-                                           eventGuid,
-                                           eventClassGuid,
-                                           readableData,
-                                           offset);
+    // Second dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::ExecutionLink,
+                                               EmptyOptional(),
+                                               entityGuid,
+                                               EmptyOptional(),
+                                               readableData,
+                                               offset);
+
+    // Third dataset sent: TimelineRelationshipBinaryPacket
+    VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType::DataLink,
+                                               EmptyOptional(),
+                                               eventGuid,
+                                               eventClassGuid,
+                                               readableData,
+                                               offset);
 
     // Mark the buffer as read
     mockBufferManager.MarkRead(readableBuffer);
index fcf40b4..2f9ac13 100644 (file)
@@ -11,58 +11,58 @@ namespace armnn
 {
 namespace timelinedecoder
 {
-TimelineDecoder::ErrorCode TimelineDecoder::CreateEntity(const Entity &entity)
+TimelineDecoder::TimelineStatus TimelineDecoder::CreateEntity(const Entity &entity)
 {
     if (m_OnNewEntityCallback == nullptr)
     {
-        return ErrorCode::ErrorCode_Fail;
+        return TimelineStatus::TimelineStatus_Fail;
     }
     m_OnNewEntityCallback(m_Model, entity);
 
-    return ErrorCode::ErrorCode_Success;
+    return TimelineStatus::TimelineStatus_Success;
 }
 
-TimelineDecoder::ErrorCode TimelineDecoder::CreateEventClass(const EventClass &eventClass)
+TimelineDecoder::TimelineStatus TimelineDecoder::CreateEventClass(const EventClass &eventClass)
 {
     if (m_OnNewEventClassCallback == nullptr)
     {
-        return ErrorCode::ErrorCode_Fail;
+        return TimelineStatus::TimelineStatus_Fail;
     }
     m_OnNewEventClassCallback(m_Model, eventClass);
 
-    return ErrorCode::ErrorCode_Success;
+    return TimelineStatus::TimelineStatus_Success;
 }
 
-TimelineDecoder::ErrorCode TimelineDecoder::CreateEvent(const Event &event)
+TimelineDecoder::TimelineStatus TimelineDecoder::CreateEvent(const Event &event)
 {
     if (m_OnNewEventCallback == nullptr)
     {
-        return ErrorCode::ErrorCode_Fail;
+        return TimelineStatus::TimelineStatus_Fail;
     }
     m_OnNewEventCallback(m_Model, event);
 
-    return ErrorCode::ErrorCode_Success;
+    return TimelineStatus::TimelineStatus_Success;
 }
 
-TimelineDecoder::ErrorCode TimelineDecoder::CreateLabel(const Label &label)
+TimelineDecoder::TimelineStatus TimelineDecoder::CreateLabel(const Label &label)
 {
     if (m_OnNewLabelCallback == nullptr)
     {
-        return ErrorCode::ErrorCode_Fail;
+        return TimelineStatus::TimelineStatus_Fail;
     }
     m_OnNewLabelCallback(m_Model, label);
 
-    return ErrorCode::ErrorCode_Success;
+    return TimelineStatus::TimelineStatus_Success;
 }
 
-TimelineDecoder::ErrorCode TimelineDecoder::CreateRelationship(const Relationship &relationship)
+TimelineDecoder::TimelineStatus TimelineDecoder::CreateRelationship(const Relationship &relationship)
 {
     if (m_OnNewRelationshipCallback == nullptr)
     {
-        return ErrorCode::ErrorCode_Fail;
+        return TimelineStatus::TimelineStatus_Fail;
     }
     m_OnNewRelationshipCallback(m_Model, relationship);
-    return ErrorCode::ErrorCode_Success;
+    return TimelineStatus::TimelineStatus_Success;
 }
 
 const TimelineDecoder::Model &TimelineDecoder::GetModel()
@@ -70,54 +70,54 @@ const TimelineDecoder::Model &TimelineDecoder::GetModel()
     return m_Model;
 }
 
-TimelineDecoder::ErrorCode TimelineDecoder::SetEntityCallback(OnNewEntityCallback cb)
+TimelineDecoder::TimelineStatus TimelineDecoder::SetEntityCallback(OnNewEntityCallback cb)
 {
     if (cb == nullptr)
     {
-        return ErrorCode::ErrorCode_Fail;
+        return TimelineStatus::TimelineStatus_Fail;
     }
     m_OnNewEntityCallback = cb;
-    return ErrorCode::ErrorCode_Success;
+    return TimelineStatus::TimelineStatus_Success;
 }
 
-TimelineDecoder::ErrorCode TimelineDecoder::SetEventClassCallback(OnNewEventClassCallback cb)
+TimelineDecoder::TimelineStatus TimelineDecoder::SetEventClassCallback(OnNewEventClassCallback cb)
 {
     if (cb == nullptr)
     {
-        return ErrorCode::ErrorCode_Fail;
+        return TimelineStatus::TimelineStatus_Fail;
     }
     m_OnNewEventClassCallback = cb;
-    return ErrorCode::ErrorCode_Success;
+    return TimelineStatus::TimelineStatus_Success;
 }
 
-TimelineDecoder::ErrorCode TimelineDecoder::SetEventCallback(OnNewEventCallback cb)
+TimelineDecoder::TimelineStatus TimelineDecoder::SetEventCallback(OnNewEventCallback cb)
 {
     if (cb == nullptr)
     {
-        return ErrorCode::ErrorCode_Fail;
+        return TimelineStatus::TimelineStatus_Fail;
     }
     m_OnNewEventCallback = cb;
-    return ErrorCode::ErrorCode_Success;
+    return TimelineStatus::TimelineStatus_Success;
 }
 
-TimelineDecoder::ErrorCode TimelineDecoder::SetLabelCallback(OnNewLabelCallback cb)
+TimelineDecoder::TimelineStatus TimelineDecoder::SetLabelCallback(OnNewLabelCallback cb)
 {
     if (cb == nullptr)
     {
-        return ErrorCode::ErrorCode_Fail;
+        return TimelineStatus::TimelineStatus_Fail;
     }
     m_OnNewLabelCallback = cb;
-    return ErrorCode::ErrorCode_Success;
+    return TimelineStatus::TimelineStatus_Success;
 }
 
-TimelineDecoder::ErrorCode TimelineDecoder::SetRelationshipCallback(OnNewRelationshipCallback cb)
+TimelineDecoder::TimelineStatus TimelineDecoder::SetRelationshipCallback(OnNewRelationshipCallback cb)
 {
     if (cb == nullptr)
     {
-        return ErrorCode::ErrorCode_Fail;
+        return TimelineStatus::TimelineStatus_Fail;
     }
     m_OnNewRelationshipCallback = cb;
-    return ErrorCode::ErrorCode_Success;
+    return TimelineStatus::TimelineStatus_Success;
 }
 
 void TimelineDecoder::print()
index fc14603..4056731 100644 (file)
@@ -31,20 +31,20 @@ public:
     using OnNewLabelCallback        =  void (*)(Model &, const Label);
     using OnNewRelationshipCallback =  void (*)(Model &, const Relationship);
 
-    virtual ErrorCode CreateEntity(const Entity &) override;
-    virtual ErrorCode CreateEventClass(const EventClass &) override;
-    virtual ErrorCode CreateEvent(const Event &) override;
-    virtual ErrorCode CreateLabel(const Label &) override;
-    virtual ErrorCode CreateRelationship(const Relationship &) override;
+    virtual TimelineStatus CreateEntity(const Entity &) override;
+    virtual TimelineStatus CreateEventClass(const EventClass &) override;
+    virtual TimelineStatus CreateEvent(const Event &) override;
+    virtual TimelineStatus CreateLabel(const Label &) override;
+    virtual TimelineStatus CreateRelationship(const Relationship &) override;
 
     const Model& GetModel();
 
 
-    ErrorCode SetEntityCallback(const OnNewEntityCallback);
-    ErrorCode SetEventClassCallback(const OnNewEventClassCallback);
-    ErrorCode SetEventCallback(const OnNewEventCallback);
-    ErrorCode SetLabelCallback(const OnNewLabelCallback);
-    ErrorCode SetRelationshipCallback(const OnNewRelationshipCallback);
+    TimelineStatus SetEntityCallback(const OnNewEntityCallback);
+    TimelineStatus SetEventClassCallback(const OnNewEventClassCallback);
+    TimelineStatus SetEventCallback(const OnNewEventCallback);
+    TimelineStatus SetLabelCallback(const OnNewLabelCallback);
+    TimelineStatus SetRelationshipCallback(const OnNewRelationshipCallback);
 
     void print();
 
index 052a3f1..02d93c3 100644 (file)
@@ -31,7 +31,6 @@ void SendTimelinePacketToCommandHandler(const unsigned char* packetBuffer,
     offset += uint32_t_size;
     header[1] = profiling::ReadUint32(packetBuffer, offset);
     offset += uint32_t_size;
-
     uint32_t PacketDataLength  = header[1] & 0x00FFFFFF;
 
     auto uniquePacketData = std::make_unique<unsigned char[]>(PacketDataLength);
@@ -155,15 +154,14 @@ BOOST_AUTO_TEST_CASE(TimelineCaptureTest)
     TimelineCaptureCommandHandler timelineCaptureCommandHandler(
         1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder, threadIdSize);
 
-    BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == ITimelineDecoder::ErrorCode::ErrorCode_Success);
-    BOOST_CHECK(
-        timelineDecoder.SetEventClassCallback(PushEventClass) == ITimelineDecoder::ErrorCode::ErrorCode_Success);
-    BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent) == ITimelineDecoder::ErrorCode::ErrorCode_Success);
-    BOOST_CHECK(timelineDecoder.SetLabelCallback(PushLabel) == ITimelineDecoder::ErrorCode::ErrorCode_Success);
-    BOOST_CHECK(
-        timelineDecoder.SetRelationshipCallback(PushRelationship) == ITimelineDecoder::ErrorCode::ErrorCode_Success);
+    using Status = ITimelineDecoder::TimelineStatus;
+    BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity)             == Status::TimelineStatus_Success);
+    BOOST_CHECK(timelineDecoder.SetEventClassCallback(PushEventClass)     == Status::TimelineStatus_Success);
+    BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent)               == Status::TimelineStatus_Success);
+    BOOST_CHECK(timelineDecoder.SetLabelCallback(PushLabel)               == Status::TimelineStatus_Success);
+    BOOST_CHECK(timelineDecoder.SetRelationshipCallback(PushRelationship) == Status::TimelineStatus_Success);
 
-    const uint64_t entityGuid = 111111u ;
+    const uint64_t entityGuid = 111111u;
     const uint64_t eventClassGuid = 22222u;
     const uint64_t timestamp = 33333u;
     const uint64_t eventGuid = 44444u;