IVGCVSW-4589 Add call to SendWellKnownLabelsAndEventClasses

Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: Ia42f962ba53d7684f5ad75f5b1b91e2d9f3a2f9c
diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.cpp b/src/profiling/ConnectionAcknowledgedCommandHandler.cpp
index 72d09b3..0071bfc 100644
--- a/src/profiling/ConnectionAcknowledgedCommandHandler.cpp
+++ b/src/profiling/ConnectionAcknowledgedCommandHandler.cpp
@@ -4,6 +4,7 @@
 //
 
 #include "ConnectionAcknowledgedCommandHandler.hpp"
+#include "TimelineUtilityMethods.hpp"
 
 #include <armnn/Exceptions.hpp>
 
@@ -41,6 +42,8 @@
         m_SendCounterPacket.SendCounterDirectoryPacket(m_CounterDirectory);
         m_SendTimelinePacket.SendTimelineMessageDirectoryPackage();
 
+        TimelineUtilityMethods::SendWellKnownLabelsAndEventClasses(m_SendTimelinePacket);
+
         break;
     case ProfilingState::Active:
         return; // NOP
diff --git a/src/profiling/TimelineUtilityMethods.cpp b/src/profiling/TimelineUtilityMethods.cpp
index ad93f4b..8a39ea7 100644
--- a/src/profiling/TimelineUtilityMethods.cpp
+++ b/src/profiling/TimelineUtilityMethods.cpp
@@ -27,53 +27,55 @@
 }
 
 
-void TimelineUtilityMethods::SendWellKnownLabelsAndEventClasses()
+void TimelineUtilityMethods::SendWellKnownLabelsAndEventClasses(ISendTimelinePacket& timelinePacket)
 {
     // Send the "name" label, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineLabelBinaryPacket(LabelsAndEventClasses::NAME_GUID,
+    timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::NAME_GUID,
                                                         LabelsAndEventClasses::NAME_LABEL);
 
     // Send the "type" label, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineLabelBinaryPacket(LabelsAndEventClasses::TYPE_GUID,
+    timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::TYPE_GUID,
                                                         LabelsAndEventClasses::TYPE_LABEL);
 
     // Send the "index" label, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineLabelBinaryPacket(LabelsAndEventClasses::INDEX_GUID,
+    timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::INDEX_GUID,
                                                         LabelsAndEventClasses::INDEX_LABEL);
 
     // Send the "backendId" label, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineLabelBinaryPacket(LabelsAndEventClasses::BACKENDID_GUID,
+    timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::BACKENDID_GUID,
                                                         LabelsAndEventClasses::BACKENDID_LABEL);
 
     // Send the "layer" label, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineLabelBinaryPacket(LabelsAndEventClasses::LAYER_GUID,
+    timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::LAYER_GUID,
                                                         LabelsAndEventClasses::LAYER);
 
     // Send the "workload" label, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineLabelBinaryPacket(LabelsAndEventClasses::WORKLOAD_GUID,
+    timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::WORKLOAD_GUID,
                                                         LabelsAndEventClasses::WORKLOAD);
 
     // Send the "network" label, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineLabelBinaryPacket(LabelsAndEventClasses::NETWORK_GUID,
+    timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::NETWORK_GUID,
                                                         LabelsAndEventClasses::NETWORK);
 
     // Send the "connection" label, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineLabelBinaryPacket(LabelsAndEventClasses::CONNECTION_GUID,
+    timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::CONNECTION_GUID,
                                                         LabelsAndEventClasses::CONNECTION);
 
     // Send the "inference" label, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineLabelBinaryPacket(LabelsAndEventClasses::INFERENCE_GUID,
+    timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::INFERENCE_GUID,
                                                         LabelsAndEventClasses::INFERENCE);
 
     // Send the "workload_execution" label, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineLabelBinaryPacket(LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
+    timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
                                                         LabelsAndEventClasses::WORKLOAD_EXECUTION);
 
     // Send the "start of life" event class, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS);
+    timelinePacket.SendTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS);
 
     // Send the "end of life" event class, this call throws in case of error
-    m_SendTimelinePacket->SendTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS);
+    timelinePacket.SendTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS);
+
+    timelinePacket.Commit();
 }
 
 ProfilingDynamicGuid TimelineUtilityMethods::CreateNamedTypedEntity(const std::string& name, const std::string& type)
diff --git a/src/profiling/TimelineUtilityMethods.hpp b/src/profiling/TimelineUtilityMethods.hpp
index 17d2aac..4f24726 100644
--- a/src/profiling/TimelineUtilityMethods.hpp
+++ b/src/profiling/TimelineUtilityMethods.hpp
@@ -39,7 +39,7 @@
 
     ~TimelineUtilityMethods() = default;
 
-    void SendWellKnownLabelsAndEventClasses();
+    static void SendWellKnownLabelsAndEventClasses(ISendTimelinePacket& timelinePacket);
 
     ProfilingDynamicGuid CreateNamedTypedEntity(const std::string& name, const std::string& type);
 
diff --git a/src/profiling/test/TimelineUtilityMethodsTests.cpp b/src/profiling/test/TimelineUtilityMethodsTests.cpp
index 5c738b6..43a5b0a 100644
--- a/src/profiling/test/TimelineUtilityMethodsTests.cpp
+++ b/src/profiling/test/TimelineUtilityMethodsTests.cpp
@@ -80,13 +80,10 @@
 BOOST_AUTO_TEST_CASE(SendWellKnownLabelsAndEventClassesTest)
 {
     MockBufferManager mockBufferManager(1024);
-    std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager);
-    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket);
+    ProfilingService  profilingService;
+    SendTimelinePacket sendTimelinePacket(mockBufferManager);
 
-    BOOST_CHECK_NO_THROW(timelineUtilityMethods.SendWellKnownLabelsAndEventClasses());
-
-    // Commit all packets at once
-    timelineUtilityMethods.Commit();
+    BOOST_CHECK_NO_THROW(TimelineUtilityMethods::SendWellKnownLabelsAndEventClasses(sendTimelinePacket));
 
     // Get the readable buffer
     auto readableBuffer = mockBufferManager.GetReadableBuffer();