IVGCVSW-4463 Change ProfilingService to a member of runtime from a singleton

Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: I345c39a10a4693a500aa1687d9a5cee76da791c3
diff --git a/src/profiling/TimelineUtilityMethods.cpp b/src/profiling/TimelineUtilityMethods.cpp
index 9729161..7310b75 100644
--- a/src/profiling/TimelineUtilityMethods.cpp
+++ b/src/profiling/TimelineUtilityMethods.cpp
@@ -4,7 +4,6 @@
 //
 
 #include "TimelineUtilityMethods.hpp"
-#include "ProfilingService.hpp"
 #include "LabelsAndEventClasses.hpp"
 
 namespace armnn
@@ -13,12 +12,12 @@
 namespace profiling
 {
 
-std::unique_ptr<TimelineUtilityMethods> TimelineUtilityMethods::GetTimelineUtils()
+std::unique_ptr<TimelineUtilityMethods> TimelineUtilityMethods::GetTimelineUtils(ProfilingService& profilingService)
 {
-    if (ProfilingService::Instance().IsEnabled())
+    if (profilingService.IsProfilingEnabled())
     {
-        std::unique_ptr<ISendTimelinePacket> sendTimelinepacket = ProfilingService::Instance().GetSendTimelinePacket();
-        return std::make_unique<TimelineUtilityMethods>(sendTimelinepacket);
+        std::unique_ptr<ISendTimelinePacket> sendTimelinepacket = profilingService.GetSendTimelinePacket();
+        return std::make_unique<TimelineUtilityMethods>(sendTimelinepacket, profilingService);
     }
     else
     {
@@ -92,7 +91,7 @@
     }
 
     // Generate dynamic GUID of the entity
-    ProfilingDynamicGuid entityGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid entityGuid = m_ProfilingService.GetNextGuid();
 
     CreateNamedTypedEntity(entityGuid, name, type);
 
@@ -155,7 +154,7 @@
     }
 
     // Generate a static GUID for the given label name
-    ProfilingStaticGuid labelGuid = ProfilingService::Instance().GenerateStaticId(labelName);
+    ProfilingStaticGuid labelGuid = m_ProfilingService.GetStaticId(labelName);
 
     // Send the new label to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
@@ -178,7 +177,7 @@
     ProfilingStaticGuid labelGuid = DeclareLabel(labelName);
 
     // Generate a GUID for the label relationship
-    ProfilingDynamicGuid relationshipGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid relationshipGuid = m_ProfilingService.GetNextGuid();
 
     // Send the new label link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
@@ -187,7 +186,7 @@
                                                                labelGuid);
 
     // Generate a GUID for the label relationship
-    ProfilingDynamicGuid relationshipLabelGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid relationshipLabelGuid = m_ProfilingService.GetNextGuid();
 
     // Send the new label link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
@@ -200,7 +199,7 @@
                                                 ProfilingStaticGuid typeNameGuid)
 {
     // Generate a GUID for the label relationship
-    ProfilingDynamicGuid relationshipGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid relationshipGuid = m_ProfilingService.GetNextGuid();
 
     // Send the new label link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
@@ -209,7 +208,7 @@
                                                                typeNameGuid);
 
     // Generate a GUID for the label relationship
-    ProfilingDynamicGuid relationshipLabelGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid relationshipLabelGuid = m_ProfilingService.GetNextGuid();
 
     // Send the new label link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
@@ -250,7 +249,7 @@
     ProfilingDynamicGuid childEntityGuid = CreateNamedTypedEntity(entityName, entityType);
 
     // Generate a GUID for the retention link relationship
-    ProfilingDynamicGuid retentionLinkGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid retentionLinkGuid = m_ProfilingService.GetNextGuid();
 
     // Send the new retention link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
@@ -284,7 +283,7 @@
     CreateNamedTypedEntity(childEntityGuid, entityName, entityType);
 
     // Generate a GUID for the retention link relationship
-    ProfilingDynamicGuid retentionLinkGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid retentionLinkGuid = m_ProfilingService.GetNextGuid();
 
     // Send the new retention link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
@@ -309,7 +308,7 @@
     CreateNamedTypedEntity(childEntityGuid, entityName, typeGuid);
 
     // Generate a GUID for the retention link relationship
-    ProfilingDynamicGuid retentionLinkGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid retentionLinkGuid = m_ProfilingService.GetNextGuid();
 
     // Send the new retention link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
@@ -323,7 +322,7 @@
                                                                 ProfilingGuid tailGuid)
 {
     // Generate a GUID for the relationship
-    ProfilingDynamicGuid relationshipGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid relationshipGuid = m_ProfilingService.GetNextGuid();
 
     // Send the new retention link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
@@ -338,7 +337,7 @@
                                                                           ProfilingGuid tailGuid)
 {
     // Generate a GUID for the relationship
-    ProfilingDynamicGuid relationshipGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid relationshipGuid = m_ProfilingService.GetNextGuid();
 
     // Send the new retention link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
@@ -368,13 +367,13 @@
     std::thread::id threadId = std::this_thread::get_id();
 
     // Generate a GUID for the event
-    ProfilingDynamicGuid eventGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid eventGuid = m_ProfilingService.GetNextGuid();
 
     // Send the new timeline event to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid);
 
     // Generate a GUID for the execution link
-    ProfilingDynamicGuid executionLinkId = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid executionLinkId = m_ProfilingService.GetNextGuid();
 
     // Send the new execution link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
@@ -383,7 +382,7 @@
                                                                eventGuid);
 
     // Generate a GUID for the data relationship link
-    ProfilingDynamicGuid eventClassLinkId = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid eventClassLinkId = m_ProfilingService.GetNextGuid();
 
     // Send the new data relationship link to the external profiling service, this call throws in case of error
     m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
@@ -397,7 +396,7 @@
 ProfilingDynamicGuid TimelineUtilityMethods::RecordWorkloadInferenceAndStartOfLifeEvent(ProfilingGuid workloadGuid,
                                                                                         ProfilingGuid inferenceGuid)
 {
-    ProfilingDynamicGuid workloadInferenceGuid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid workloadInferenceGuid = m_ProfilingService.GetNextGuid();
     CreateTypedEntity(workloadInferenceGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID);
     CreateRelationship(ProfilingRelationshipType::RetentionLink, inferenceGuid, workloadInferenceGuid);
     CreateRelationship(ProfilingRelationshipType::RetentionLink, workloadGuid, workloadInferenceGuid);