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/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
index f111de1..e42ef13 100644
--- a/src/profiling/ProfilingService.cpp
+++ b/src/profiling/ProfilingService.cpp
@@ -17,6 +17,18 @@
 namespace profiling
 {
 
+ProfilingGuidGenerator ProfilingService::m_GuidGenerator;
+
+ProfilingDynamicGuid ProfilingService::GetNextGuid()
+{
+    return m_GuidGenerator.NextGuid();
+}
+
+ProfilingStaticGuid ProfilingService::GetStaticId(const std::string& str)
+{
+    return m_GuidGenerator.GenerateStaticId(str);
+}
+
 void ProfilingService::ResetExternalProfilingOptions(const ExternalProfilingOptions& options,
                                                      bool resetProfilingService)
 {
@@ -285,12 +297,12 @@
 
 ProfilingDynamicGuid ProfilingService::NextGuid()
 {
-    return m_GuidGenerator.NextGuid();
+    return ProfilingService::GetNextGuid();
 }
 
 ProfilingStaticGuid ProfilingService::GenerateStaticId(const std::string& str)
 {
-    return m_GuidGenerator.GenerateStaticId(str);
+    return ProfilingService::GetStaticId(str);
 }
 
 std::unique_ptr<ISendTimelinePacket> ProfilingService::GetSendTimelinePacket() const
diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp
index 4629c12..f6e409d 100644
--- a/src/profiling/ProfilingService.hpp
+++ b/src/profiling/ProfilingService.hpp
@@ -48,114 +48,6 @@
     using CounterIndices = std::vector<std::atomic<uint32_t>*>;
     using CounterValues = std::list<std::atomic<uint32_t>>;
 
-    // Getter for the singleton instance
-    static ProfilingService& Instance()
-    {
-        static ProfilingService instance;
-        return instance;
-    }
-
-    // Resets the profiling options, optionally clears the profiling service entirely
-    void ResetExternalProfilingOptions(const ExternalProfilingOptions& options, bool resetProfilingService = false);
-    ProfilingState ConfigureProfilingService(const ExternalProfilingOptions& options,
-                                             bool resetProfilingService = false);
-
-
-    // Updates the profiling service, making it transition to a new state if necessary
-    void Update();
-
-    // Disconnects the profiling service from the external server
-    void Disconnect();
-
-    // Store a profiling context returned from a backend that support profiling.
-    void AddBackendProfilingContext(const BackendId backendId,
-        std::shared_ptr<armnn::profiling::IBackendProfilingContext> profilingContext);
-
-    const ICounterDirectory& GetCounterDirectory() const;
-    ICounterRegistry& GetCounterRegistry();
-    ProfilingState GetCurrentState() const;
-    bool IsCounterRegistered(uint16_t counterUid) const override;
-    uint32_t GetCounterValue(uint16_t counterUid) const override;
-    uint16_t GetCounterCount() const override;
-    // counter global/backend mapping functions
-    const ICounterMappings& GetCounterMappings() const override;
-    IRegisterCounterMapping& GetCounterMappingRegistry();
-
-    // Getters for the profiling service state
-    bool IsProfilingEnabled() const override;
-
-    CaptureData GetCaptureData() override;
-    void SetCaptureData(uint32_t capturePeriod,
-                        const std::vector<uint16_t>& counterIds,
-                        const std::set<BackendId>& activeBackends);
-
-    // Setters for the profiling service state
-    void SetCounterValue(uint16_t counterUid, uint32_t value) override;
-    uint32_t AddCounterValue(uint16_t counterUid, uint32_t value) override;
-    uint32_t SubtractCounterValue(uint16_t counterUid, uint32_t value) override;
-    uint32_t IncrementCounterValue(uint16_t counterUid) override;
-
-    // IProfilingGuidGenerator functions
-    /// Return the next random Guid in the sequence
-    ProfilingDynamicGuid NextGuid() override;
-    /// Create a ProfilingStaticGuid based on a hash of the string
-    ProfilingStaticGuid GenerateStaticId(const std::string& str) override;
-
-    std::unique_ptr<ISendTimelinePacket> GetSendTimelinePacket() const override;
-
-    ISendCounterPacket& GetSendCounterPacket() override
-    {
-        return m_SendCounterPacket;
-    }
-
-    /// Check if the profiling is enabled
-    bool IsEnabled() { return m_Options.m_EnableProfiling; }
-
-private:
-    // Copy/move constructors/destructors and copy/move assignment operators are deleted
-    ProfilingService(const ProfilingService&) = delete;
-    ProfilingService(ProfilingService&&) = delete;
-    ProfilingService& operator=(const ProfilingService&) = delete;
-    ProfilingService& operator=(ProfilingService&&) = delete;
-
-    // Initialization/reset functions
-    void Initialize();
-    void InitializeCounterValue(uint16_t counterUid);
-    void Reset();
-    void Stop();
-
-    // Helper function
-    void CheckCounterUid(uint16_t counterUid) const;
-
-    // Profiling service components
-    ExternalProfilingOptions m_Options;
-    CounterDirectory m_CounterDirectory;
-    CounterIdMap m_CounterIdMap;
-    IProfilingConnectionFactoryPtr m_ProfilingConnectionFactory;
-    IProfilingConnectionPtr m_ProfilingConnection;
-    ProfilingStateMachine m_StateMachine;
-    CounterIndices m_CounterIndex;
-    CounterValues m_CounterValues;
-    CommandHandlerRegistry m_CommandHandlerRegistry;
-    PacketVersionResolver m_PacketVersionResolver;
-    CommandHandler m_CommandHandler;
-    BufferManager m_BufferManager;
-    SendCounterPacket m_SendCounterPacket;
-    SendThread m_SendThread;
-    SendTimelinePacket m_SendTimelinePacket;
-    Holder m_Holder;
-    PeriodicCounterCapture m_PeriodicCounterCapture;
-    ConnectionAcknowledgedCommandHandler m_ConnectionAcknowledgedCommandHandler;
-    RequestCounterDirectoryCommandHandler m_RequestCounterDirectoryCommandHandler;
-    PeriodicCounterSelectionCommandHandler m_PeriodicCounterSelectionCommandHandler;
-    PerJobCounterSelectionCommandHandler m_PerJobCounterSelectionCommandHandler;
-    ProfilingGuidGenerator m_GuidGenerator;
-    TimelinePacketWriterFactory m_TimelinePacketWriterFactory;
-    std::unordered_map<BackendId,
-    std::shared_ptr<armnn::profiling::IBackendProfilingContext>> m_BackendProfilingContexts;
-    uint16_t m_MaxGlobalCounterId;
-
-protected:
     // Default constructor/destructor kept protected for testing
     ProfilingService()
         : m_Options()
@@ -220,8 +112,117 @@
         // Register the "Per-Job Counter Selection" command handler
         m_CommandHandlerRegistry.RegisterFunctor(&m_PerJobCounterSelectionCommandHandler);
     }
+
     ~ProfilingService();
 
+    // Resets the profiling options, optionally clears the profiling service entirely
+    void ResetExternalProfilingOptions(const ExternalProfilingOptions& options, bool resetProfilingService = false);
+    ProfilingState ConfigureProfilingService(const ExternalProfilingOptions& options,
+                                             bool resetProfilingService = false);
+
+
+    // Updates the profiling service, making it transition to a new state if necessary
+    void Update();
+
+    // Disconnects the profiling service from the external server
+    void Disconnect();
+
+    // Store a profiling context returned from a backend that support profiling.
+    void AddBackendProfilingContext(const BackendId backendId,
+        std::shared_ptr<armnn::profiling::IBackendProfilingContext> profilingContext);
+
+    const ICounterDirectory& GetCounterDirectory() const;
+    ICounterRegistry& GetCounterRegistry();
+    ProfilingState GetCurrentState() const;
+    bool IsCounterRegistered(uint16_t counterUid) const override;
+    uint32_t GetCounterValue(uint16_t counterUid) const override;
+    uint16_t GetCounterCount() const override;
+    // counter global/backend mapping functions
+    const ICounterMappings& GetCounterMappings() const override;
+    IRegisterCounterMapping& GetCounterMappingRegistry();
+
+    // Getters for the profiling service state
+    bool IsProfilingEnabled() const override;
+
+    CaptureData GetCaptureData() override;
+    void SetCaptureData(uint32_t capturePeriod,
+                        const std::vector<uint16_t>& counterIds,
+                        const std::set<BackendId>& activeBackends);
+
+    // Setters for the profiling service state
+    void SetCounterValue(uint16_t counterUid, uint32_t value) override;
+    uint32_t AddCounterValue(uint16_t counterUid, uint32_t value) override;
+    uint32_t SubtractCounterValue(uint16_t counterUid, uint32_t value) override;
+    uint32_t IncrementCounterValue(uint16_t counterUid) override;
+
+    // IProfilingGuidGenerator functions
+    /// Return the next random Guid in the sequence
+    ProfilingDynamicGuid NextGuid() override;
+    /// Create a ProfilingStaticGuid based on a hash of the string
+    ProfilingStaticGuid GenerateStaticId(const std::string& str) override;
+
+    std::unique_ptr<ISendTimelinePacket> GetSendTimelinePacket() const override;
+
+    ISendCounterPacket& GetSendCounterPacket() override
+    {
+        return m_SendCounterPacket;
+    }
+
+    /// Check if the profiling is enabled
+    bool IsEnabled() { return m_Options.m_EnableProfiling; }
+
+    static ProfilingDynamicGuid GetNextGuid();
+
+    static ProfilingStaticGuid GetStaticId(const std::string& str);
+
+private:
+    //Copy/move constructors/destructors and copy/move assignment operators are deleted
+    ProfilingService(const ProfilingService&) = delete;
+    ProfilingService(ProfilingService&&) = delete;
+    ProfilingService& operator=(const ProfilingService&) = delete;
+    ProfilingService& operator=(ProfilingService&&) = delete;
+
+    // Initialization/reset functions
+    void Initialize();
+    void InitializeCounterValue(uint16_t counterUid);
+    void Reset();
+    void Stop();
+
+    // Helper function
+    void CheckCounterUid(uint16_t counterUid) const;
+
+    // Profiling service components
+    ExternalProfilingOptions m_Options;
+    CounterDirectory m_CounterDirectory;
+    CounterIdMap m_CounterIdMap;
+    IProfilingConnectionFactoryPtr m_ProfilingConnectionFactory;
+    IProfilingConnectionPtr m_ProfilingConnection;
+    ProfilingStateMachine m_StateMachine;
+    CounterIndices m_CounterIndex;
+    CounterValues m_CounterValues;
+    CommandHandlerRegistry m_CommandHandlerRegistry;
+    PacketVersionResolver m_PacketVersionResolver;
+    CommandHandler m_CommandHandler;
+    BufferManager m_BufferManager;
+    SendCounterPacket m_SendCounterPacket;
+    SendThread m_SendThread;
+    SendTimelinePacket m_SendTimelinePacket;
+    Holder m_Holder;
+    PeriodicCounterCapture m_PeriodicCounterCapture;
+    ConnectionAcknowledgedCommandHandler m_ConnectionAcknowledgedCommandHandler;
+    RequestCounterDirectoryCommandHandler m_RequestCounterDirectoryCommandHandler;
+    PeriodicCounterSelectionCommandHandler m_PeriodicCounterSelectionCommandHandler;
+    PerJobCounterSelectionCommandHandler m_PerJobCounterSelectionCommandHandler;
+
+    TimelinePacketWriterFactory m_TimelinePacketWriterFactory;
+    std::unordered_map<BackendId,
+    std::shared_ptr<armnn::profiling::IBackendProfilingContext>> m_BackendProfilingContexts;
+    uint16_t m_MaxGlobalCounterId;
+
+    static ProfilingGuidGenerator m_GuidGenerator;
+
+protected:
+
     // Protected methods for testing
     void SwapProfilingConnectionFactory(ProfilingService& instance,
                                         IProfilingConnectionFactory* other,
diff --git a/src/profiling/RegisterBackendCounters.cpp b/src/profiling/RegisterBackendCounters.cpp
index 36f6106..035a2ca 100644
--- a/src/profiling/RegisterBackendCounters.cpp
+++ b/src/profiling/RegisterBackendCounters.cpp
@@ -59,7 +59,7 @@
                                                                    counterSetUid);
     m_CurrentMaxGlobalCounterID = counterPtr->m_MaxCounterUid;
     // register mappings
-    IRegisterCounterMapping& counterIdMap = ProfilingService::Instance().GetCounterMappingRegistry();
+    IRegisterCounterMapping& counterIdMap = m_ProfilingService.GetCounterMappingRegistry();
     uint16_t globalCounterId = counterPtr->m_Uid;
     if (globalCounterId == counterPtr->m_MaxCounterUid)
     {
diff --git a/src/profiling/RegisterBackendCounters.hpp b/src/profiling/RegisterBackendCounters.hpp
index 8f1fa04..f81f487 100644
--- a/src/profiling/RegisterBackendCounters.hpp
+++ b/src/profiling/RegisterBackendCounters.hpp
@@ -20,10 +20,12 @@
 {
 public:
 
-    RegisterBackendCounters(uint16_t currentMaxGlobalCounterID, const BackendId& backendId)
-                            : m_CurrentMaxGlobalCounterID(currentMaxGlobalCounterID),
-                              m_CounterDirectory(ProfilingService::Instance().GetCounterRegistry()),
-                              m_BackendId(backendId) {}
+    RegisterBackendCounters(
+        uint16_t currentMaxGlobalCounterID, const BackendId& backendId, ProfilingService& profilingService)
+        : m_CurrentMaxGlobalCounterID(currentMaxGlobalCounterID),
+          m_BackendId(backendId),
+          m_ProfilingService(profilingService),
+          m_CounterDirectory(m_ProfilingService.GetCounterRegistry()) {}
 
     ~RegisterBackendCounters() = default;
 
@@ -51,8 +53,9 @@
 
 private:
     uint16_t m_CurrentMaxGlobalCounterID;
-    ICounterRegistry& m_CounterDirectory;
     const BackendId& m_BackendId;
+    ProfilingService& m_ProfilingService;
+    ICounterRegistry& m_CounterDirectory;
 };
 
 } // namespace profiling
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);
diff --git a/src/profiling/TimelineUtilityMethods.hpp b/src/profiling/TimelineUtilityMethods.hpp
index c33dd92..df56cd6 100644
--- a/src/profiling/TimelineUtilityMethods.hpp
+++ b/src/profiling/TimelineUtilityMethods.hpp
@@ -5,7 +5,9 @@
 
 #pragma once
 
+#include "ProfilingService.hpp"
 #include "armnn/profiling/ISendTimelinePacket.hpp"
+
 #include <armnn/Types.hpp>
 
 namespace armnn
@@ -20,13 +22,14 @@
 
     // static factory method which will return a pointer to a timelie utility methods
     // object if profiling is enabled. Otherwise will return a null unique_ptr
-    static std::unique_ptr<TimelineUtilityMethods> GetTimelineUtils();
+    static std::unique_ptr<TimelineUtilityMethods> GetTimelineUtils(ProfilingService& profilingService);
 
-    TimelineUtilityMethods(std::unique_ptr<ISendTimelinePacket>& sendTimelinePacket)
-        : m_SendTimelinePacket(std::move(sendTimelinePacket)) {}
+    TimelineUtilityMethods(
+        std::unique_ptr<ISendTimelinePacket>& sendTimelinePacket, ProfilingService& profilingService)
+        : m_SendTimelinePacket(std::move(sendTimelinePacket)), m_ProfilingService(profilingService) {}
 
     TimelineUtilityMethods(TimelineUtilityMethods&& other)
-        : m_SendTimelinePacket(std::move(other.m_SendTimelinePacket)) {}
+        : m_SendTimelinePacket(std::move(other.m_SendTimelinePacket)), m_ProfilingService(other.m_ProfilingService) {}
 
     TimelineUtilityMethods(const TimelineUtilityMethods& other) = delete;
 
@@ -89,6 +92,7 @@
 
 private:
     std::unique_ptr<ISendTimelinePacket> m_SendTimelinePacket;
+    profiling::ProfilingService&  m_ProfilingService;
 };
 
 } // namespace profiling
diff --git a/src/profiling/backends/BackendProfiling.cpp b/src/profiling/backends/BackendProfiling.cpp
index 0926879..4e6de93 100644
--- a/src/profiling/backends/BackendProfiling.cpp
+++ b/src/profiling/backends/BackendProfiling.cpp
@@ -15,7 +15,8 @@
 std::unique_ptr<IRegisterBackendCounters>
     BackendProfiling::GetCounterRegistrationInterface(uint16_t currentMaxGlobalCounterID)
 {
-    return std::make_unique<RegisterBackendCounters>(RegisterBackendCounters(currentMaxGlobalCounterID, m_BackendId));
+    return std::make_unique<RegisterBackendCounters>(
+        RegisterBackendCounters(currentMaxGlobalCounterID, m_BackendId, m_ProfilingService));
 }
 
 std::unique_ptr<ISendTimelinePacket> BackendProfiling::GetSendTimelinePacket()
@@ -73,7 +74,7 @@
     for (auto globalCounterId : globalCounterIds) {
         // Get pair of local counterId and backendId using globalCounterId
         const std::pair<uint16_t, armnn::BackendId>& backendCounterIdPair =
-                ProfilingService::Instance().GetCounterMappings().GetBackendId(globalCounterId);
+                m_ProfilingService.GetCounterMappings().GetBackendId(globalCounterId);
         if (backendCounterIdPair.second == m_BackendId)
         {
             activeCounterIds.emplace_back(backendCounterIdPair.first,
diff --git a/src/profiling/backends/BackendProfiling.hpp b/src/profiling/backends/BackendProfiling.hpp
index c0f3eea..71d0af1 100644
--- a/src/profiling/backends/BackendProfiling.hpp
+++ b/src/profiling/backends/BackendProfiling.hpp
@@ -5,7 +5,7 @@
 
 #pragma once
 
-#include "IProfilingService.hpp"
+#include "ProfilingService.hpp"
 #include <armnn/backends/profiling/IBackendProfiling.hpp>
 
 namespace armnn
@@ -18,7 +18,7 @@
 {
 public:
     BackendProfiling(const IRuntime::CreationOptions& options,
-                     IProfilingService& profilingService,
+                     ProfilingService& profilingService,
                      const BackendId& backendId)
             : m_Options(options),
               m_ProfilingService(profilingService),
@@ -44,7 +44,7 @@
 
 private:
     IRuntime::CreationOptions m_Options;
-    IProfilingService& m_ProfilingService;
+    ProfilingService& m_ProfilingService;
     BackendId m_BackendId;
 };
 }    // namespace profiling
diff --git a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
index 7db42de..baadb85 100644
--- a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
+++ b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
@@ -30,8 +30,9 @@
     // Wait for a notification from the send thread
     bool WaitForPacketsSent(uint32_t timeout = 1000)
     {
-        return ProfilingService::WaitForPacketSent(ProfilingService::Instance(), timeout);
+        return ProfilingService::WaitForPacketSent(m_ProfilingService, timeout);
     }
+    armnn::profiling::ProfilingService m_ProfilingService;
 };
 
 BOOST_AUTO_TEST_SUITE(FileOnlyProfilingDecoratorTests)
@@ -52,7 +53,7 @@
     FileOnlyHelperService helper;
 
     // Enable the profiling service
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
     // Bring the profiling service to the "WaitingForAck" state
     profilingService.Update();
diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp
index 944aea6..eeb641e 100644
--- a/src/profiling/test/ProfilingMocks.hpp
+++ b/src/profiling/test/ProfilingMocks.hpp
@@ -7,7 +7,7 @@
 
 #include <Holder.hpp>
 #include <IProfilingConnectionFactory.hpp>
-#include <IProfilingService.hpp>
+#include <ProfilingService.hpp>
 #include <ProfilingGuidGenerator.hpp>
 #include <ProfilingUtils.hpp>
 #include <SendCounterPacket.hpp>
@@ -620,7 +620,7 @@
     Counters    m_Counters;
 };
 
-class MockProfilingService : public IProfilingService, public IRegisterCounterMapping
+class MockProfilingService : public ProfilingService
 {
 public:
     MockProfilingService(MockBufferManager& mockBufferManager,
@@ -670,12 +670,12 @@
 
     void RegisterMapping(uint16_t globalCounterId,
                          uint16_t backendCounterId,
-                         const armnn::BackendId& backendId) override
+                         const armnn::BackendId& backendId)
     {
         m_CounterMapping.RegisterMapping(globalCounterId, backendCounterId, backendId);
     }
 
-    void Reset() override
+    void Reset()
     {
         m_CounterMapping.Reset();
     }
diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp
index 89b5926..17291ba 100644
--- a/src/profiling/test/ProfilingTestUtils.cpp
+++ b/src/profiling/test/ProfilingTestUtils.cpp
@@ -9,6 +9,7 @@
 #include <armnn/Descriptors.hpp>
 #include <LabelsAndEventClasses.hpp>
 #include <ProfilingService.hpp>
+#include <Runtime.hpp>
 
 #include <boost/test/unit_test.hpp>
 
@@ -78,7 +79,8 @@
     }
     else
     {
-        BOOST_CHECK(readProfilingGuid == ProfilingService::Instance().GenerateStaticId(label));
+        armnn::profiling::ProfilingService profilingService;
+        BOOST_CHECK(readProfilingGuid == profilingService.GetStaticId(label));
     }
 
     // Check the SWTrace label
@@ -294,9 +296,8 @@
     // Create runtime in which test will run
     armnn::IRuntime::CreationOptions options;
     options.m_ProfilingOptions.m_EnableProfiling = true;
-    armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance();
-    profilingService.ConfigureProfilingService(options.m_ProfilingOptions, true);
-    armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
+//    armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
+    armnn::Runtime runtime(options);
 
     // build up the structure of the network
     INetworkPtr net(INetwork::Create());
@@ -354,15 +355,15 @@
 
     // optimize the network
     std::vector<armnn::BackendId> backends = { backendId };
-    IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec());
+    IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime.GetDeviceSpec());
 
     ProfilingGuid optNetGuid = optNet->GetGuid();
 
     // Load it into the runtime. It should success.
     armnn::NetworkId netId;
-    BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == Status::Success);
+    BOOST_TEST(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success);
 
-    profiling::ProfilingServiceRuntimeHelper profilingServiceHelper;
+    profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime));
     profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager();
     auto readableBuffer = bufferManager.GetReadableBuffer();
 
@@ -762,15 +763,15 @@
 
     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);
+    runtime.EnqueueWorkload(netId, inputTensors, outputTensors);
 
     // Get readable buffer for inference timeline
     auto inferenceReadableBuffer = bufferManager.GetReadableBuffer();
diff --git a/src/profiling/test/ProfilingTestUtils.hpp b/src/profiling/test/ProfilingTestUtils.hpp
index 175c9cc..459d624 100644
--- a/src/profiling/test/ProfilingTestUtils.hpp
+++ b/src/profiling/test/ProfilingTestUtils.hpp
@@ -59,13 +59,15 @@
 class ProfilingServiceRuntimeHelper : public ProfilingService
 {
 public:
-    ProfilingServiceRuntimeHelper() = default;
+    ProfilingServiceRuntimeHelper(ProfilingService& profilingService)
+    : m_ProfilingService(profilingService) {}
     ~ProfilingServiceRuntimeHelper() = default;
 
     BufferManager& GetProfilingBufferManager()
     {
-        return GetBufferManager(ProfilingService::Instance());
+        return GetBufferManager(m_ProfilingService);
     }
+    armnn::profiling::ProfilingService& m_ProfilingService;
 };
 
 } // namespace profiling
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp
index 0e91696..29c5299 100644
--- a/src/profiling/test/ProfilingTests.cpp
+++ b/src/profiling/test/ProfilingTests.cpp
@@ -645,7 +645,7 @@
 BOOST_AUTO_TEST_CASE(CheckProfilingServiceDisabled)
 {
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();
@@ -655,7 +655,7 @@
 BOOST_AUTO_TEST_CASE(CheckProfilingServiceCounterDirectory)
 {
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
     const ICounterDirectory& counterDirectory0 = profilingService.GetCounterDirectory();
@@ -679,7 +679,7 @@
 {
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
     profilingService.Update();
@@ -2332,9 +2332,6 @@
 
 BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodConnectionAcknowledgedPacket)
 {
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
-
     // Calculate the size of a Stream Metadata packet
     std::string processName      = GetProcessName().substr(0, 60);
     unsigned int processNameSize = processName.empty() ? 0 : boost::numeric_cast<unsigned int>(processName.size()) + 1;
@@ -2343,9 +2340,12 @@
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Bring the profiling service to the "WaitingForAck" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();    // Initialize the counter directory
@@ -2397,15 +2397,15 @@
 
 BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodRequestCounterDirectoryPacket)
 {
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
-
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Bring the profiling service to the "Active" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();    // Initialize the counter directory
@@ -2455,15 +2455,15 @@
 
 BOOST_AUTO_TEST_CASE(CheckProfilingServiceBadPeriodicCounterSelectionPacketInvalidCounterUid)
 {
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
-
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Bring the profiling service to the "Active" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();    // Initialize the counter directory
@@ -2533,15 +2533,15 @@
 
 BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketNoCounters)
 {
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
-
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Bring the profiling service to the "Active" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();    // Initialize the counter directory
@@ -2597,15 +2597,15 @@
 
 BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketSingleCounter)
 {
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
-
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Bring the profiling service to the "Active" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();    // Initialize the counter directory
@@ -2674,14 +2674,15 @@
 
 BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketMultipleCounters)
 {
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Bring the profiling service to the "Active" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();    // Initialize the counter directory
@@ -2752,14 +2753,15 @@
 
 BOOST_AUTO_TEST_CASE(CheckProfilingServiceDisconnect)
 {
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Try to disconnect the profiling service while in the "Uninitialised" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Disconnect();
@@ -2809,14 +2811,15 @@
 
 BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPerJobCounterSelectionPacket)
 {
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Bring the profiling service to the "Active" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();    // Initialize the counter directory
@@ -2877,7 +2880,7 @@
 {
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.ConfigureProfilingService(options);
     // should get as far as NOT_CONNECTED
@@ -2890,7 +2893,7 @@
 BOOST_AUTO_TEST_CASE(CheckConfigureProfilingServiceOff)
 {
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.ConfigureProfilingService(options);
     // should not move from Uninitialised
@@ -2906,7 +2909,7 @@
     LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning);
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();
@@ -2936,7 +2939,7 @@
     // Locally reduce log level to "Warning", as this test needs to parse a warning message from the standard output
     LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning);
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();
@@ -2970,8 +2973,7 @@
 {
     // Locally reduce log level to "Warning", as this test needs to parse a warning message from the standard output
     LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning);
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
+
 
     // Redirect the standard output to a local stream so that we can parse the warning message
     std::stringstream ss;
@@ -2980,9 +2982,12 @@
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Bring the profiling service to the "WaitingForAck" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();    // Initialize the counter directory
@@ -3031,8 +3036,6 @@
 {
     // Locally reduce log level to "Warning", as this test needs to parse a warning message from the standard output
     LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning);
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
 
     // Redirect the standard output to a local stream so that we can parse the warning message
     std::stringstream ss;
@@ -3041,9 +3044,12 @@
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Bring the profiling service to the "Active" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     helper.ForceTransitionToState(ProfilingState::NotConnected);
@@ -3094,8 +3100,6 @@
 {
     // Locally reduce log level to "Warning", as this test needs to parse a warning message from the standard output
     LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning);
-    // Swap the profiling connection factory in the profiling service instance with our mock one
-    SwapProfilingConnectionFactoryHelper helper;
 
     // Redirect the standard output to a local stream so that we can parse the warning message
     std::stringstream ss;
@@ -3104,9 +3108,12 @@
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    // Swap the profiling connection factory in the profiling service instance with our mock one
+    SwapProfilingConnectionFactoryHelper helper(profilingService);
+
     // Bring the profiling service to the "Active" state
     BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised);
     profilingService.Update();    // Initialize the counter directory
@@ -3198,14 +3205,16 @@
     uint16_t globalCounterIds = armnn::profiling::INFERENCES_RUN;
     armnn::BackendId cpuRefId(armnn::Compute::CpuRef);
 
-    RegisterBackendCounters registerBackendCounters(globalCounterIds, cpuRefId);
-
     // Reset the profiling service to the uninitialized state
     armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling          = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
+    RegisterBackendCounters registerBackendCounters(globalCounterIds, cpuRefId, profilingService);
+
+
+
     BOOST_CHECK(profilingService.GetCounterDirectory().GetCategories().empty());
     registerBackendCounters.RegisterCategory("categoryOne");
     auto categoryOnePtr = profilingService.GetCounterDirectory().GetCategory("categoryOne");
@@ -3248,7 +3257,7 @@
     options.m_ProfilingOptions.m_EnableProfiling = true;
 
     // Reset the profiling service to the uninitialized state
-    ProfilingService& profilingService = ProfilingService::Instance();
+    ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options.m_ProfilingOptions, true);
 
     const armnn::BackendId cpuRefId(armnn::Compute::CpuRef);
@@ -3261,7 +3270,7 @@
     uint16_t initialNumGlobalCounterIds = armnn::profiling::INFERENCES_RUN;
 
     // Create RegisterBackendCounters for CpuRef
-    RegisterBackendCounters registerBackendCountersCpuRef(initialNumGlobalCounterIds, cpuRefId);
+    RegisterBackendCounters registerBackendCountersCpuRef(initialNumGlobalCounterIds, cpuRefId, profilingService);
 
     // Create 'testCategory' in CounterDirectory (backend agnostic)
     BOOST_CHECK(profilingService.GetCounterDirectory().GetCategories().empty());
@@ -3298,7 +3307,7 @@
     BOOST_CHECK(backendMapping.second == cpuRefId);
 
     // Create RegisterBackendCounters for CpuAcc
-    RegisterBackendCounters registerBackendCountersCpuAcc(currentNumGlobalCounterIds, cpuAccId);
+    RegisterBackendCounters registerBackendCountersCpuAcc(currentNumGlobalCounterIds, cpuAccId, profilingService);
 
     // Register the backend counter for CpuAcc and validate GetGlobalId and GetBackendId
     currentNumGlobalCounterIds = registerBackendCountersCpuAcc.RegisterCounter(
@@ -3384,6 +3393,7 @@
     armnn::Runtime::CreationOptions options;
     options.m_ProfilingOptions.m_EnableProfiling = true;
     MockBufferManager mockBuffer(1024);
+
     CaptureData captureData;
     MockProfilingService mockProfilingService(
         mockBuffer, options.m_ProfilingOptions.m_EnableProfiling, captureData);
diff --git a/src/profiling/test/ProfilingTests.hpp b/src/profiling/test/ProfilingTests.hpp
index 0081103..a5971e0 100644
--- a/src/profiling/test/ProfilingTests.hpp
+++ b/src/profiling/test/ProfilingTests.hpp
@@ -204,13 +204,15 @@
 public:
     using MockProfilingConnectionFactoryPtr = std::unique_ptr<MockProfilingConnectionFactory>;
 
-    SwapProfilingConnectionFactoryHelper()
+    SwapProfilingConnectionFactoryHelper(armnn::profiling::ProfilingService& profilingService)
         : ProfilingService()
+        , m_ProfilingService(profilingService)
         , m_MockProfilingConnectionFactory(new MockProfilingConnectionFactory())
         , m_BackupProfilingConnectionFactory(nullptr)
+
     {
         BOOST_CHECK(m_MockProfilingConnectionFactory);
-        SwapProfilingConnectionFactory(ProfilingService::Instance(),
+        SwapProfilingConnectionFactory(m_ProfilingService,
                                        m_MockProfilingConnectionFactory.get(),
                                        m_BackupProfilingConnectionFactory);
         BOOST_CHECK(m_BackupProfilingConnectionFactory);
@@ -219,20 +221,20 @@
     {
         BOOST_CHECK(m_BackupProfilingConnectionFactory);
         IProfilingConnectionFactory* temp = nullptr;
-        SwapProfilingConnectionFactory(ProfilingService::Instance(),
+        SwapProfilingConnectionFactory(m_ProfilingService,
                                        m_BackupProfilingConnectionFactory,
                                        temp);
     }
 
     MockProfilingConnection* GetMockProfilingConnection()
     {
-        IProfilingConnection* profilingConnection = GetProfilingConnection(ProfilingService::Instance());
+        IProfilingConnection* profilingConnection = GetProfilingConnection(m_ProfilingService);
         return boost::polymorphic_downcast<MockProfilingConnection*>(profilingConnection);
     }
 
     void ForceTransitionToState(ProfilingState newState)
     {
-        TransitionToState(ProfilingService::Instance(), newState);
+        TransitionToState(m_ProfilingService, newState);
     }
 
     long WaitForPacketsSent(MockProfilingConnection* mockProfilingConnection,
@@ -247,7 +249,7 @@
         {
             std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
             // Wait for a notification from the send thread
-            ProfilingService::WaitForPacketSent(ProfilingService::Instance(), timeout);
+            ProfilingService::WaitForPacketSent(m_ProfilingService, timeout);
 
             std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
 
@@ -268,6 +270,7 @@
     }
 
 private:
+    armnn::profiling::ProfilingService& m_ProfilingService;
     MockProfilingConnectionFactoryPtr m_MockProfilingConnectionFactory;
     IProfilingConnectionFactory* m_BackupProfilingConnectionFactory;
 };
diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp
index 2e64c75..c03e745 100644
--- a/src/profiling/test/SendTimelinePacketTests.cpp
+++ b/src/profiling/test/SendTimelinePacketTests.cpp
@@ -397,18 +397,18 @@
 {
     armnn::IRuntime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
-    ProfilingStaticGuid staticGuid = profilingService.GenerateStaticId("dummy");
+    ProfilingStaticGuid staticGuid = profilingService.GetStaticId("dummy");
     std::hash<std::string> hasher;
     uint64_t hash = static_cast<uint64_t>(hasher("dummy"));
     ProfilingStaticGuid expectedStaticValue(hash | MIN_STATIC_GUID);
     BOOST_CHECK(staticGuid == expectedStaticValue);
-    ProfilingDynamicGuid dynamicGuid = profilingService.NextGuid();
+    ProfilingDynamicGuid dynamicGuid = profilingService.GetNextGuid();
     uint64_t dynamicGuidValue = static_cast<uint64_t>(dynamicGuid);
     ++dynamicGuidValue;
     ProfilingDynamicGuid expectedDynamicValue(dynamicGuidValue);
-    dynamicGuid = profilingService.NextGuid();
+    dynamicGuid = profilingService.GetNextGuid();
     BOOST_CHECK(dynamicGuid == expectedDynamicValue);
 }
 
@@ -416,7 +416,7 @@
 {
     armnn::IRuntime::CreationOptions::ExternalProfilingOptions options;
     options.m_EnableProfiling = true;
-    ProfilingService& profilingService = ProfilingService::Instance();
+    armnn::profiling::ProfilingService profilingService;
     profilingService.ResetExternalProfilingOptions(options, true);
 
     std::unique_ptr<ISendTimelinePacket> writer = profilingService.GetSendTimelinePacket();
diff --git a/src/profiling/test/TimelineUtilityMethodsTests.cpp b/src/profiling/test/TimelineUtilityMethodsTests.cpp
index fed31c3..f83a962 100644
--- a/src/profiling/test/TimelineUtilityMethodsTests.cpp
+++ b/src/profiling/test/TimelineUtilityMethodsTests.cpp
@@ -23,11 +23,13 @@
 BOOST_AUTO_TEST_CASE(CreateTypedLabelTest)
 {
     MockBufferManager mockBufferManager(1024);
+    ProfilingService  profilingService;
+
     std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager);
-    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket);
+    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket, profilingService);
 
     // Generate first guid to ensure that the named typed entity guid is not 0 on local single test.
-    ProfilingService::Instance().NextGuid();
+    profilingService.NextGuid();
 
     ProfilingGuid entityGuid(123);
     const std::string entityName = "some entity";
@@ -78,8 +80,9 @@
 BOOST_AUTO_TEST_CASE(SendWellKnownLabelsAndEventClassesTest)
 {
     MockBufferManager mockBufferManager(1024);
+    ProfilingService  profilingService;
     std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager);
-    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket);
+    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket, profilingService);
 
     BOOST_CHECK_NO_THROW(timelineUtilityMethods.SendWellKnownLabelsAndEventClasses());
 
@@ -178,8 +181,9 @@
 BOOST_AUTO_TEST_CASE(CreateNamedTypedChildEntityTest)
 {
     MockBufferManager mockBufferManager(1024);
+    ProfilingService  profilingService;
     std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager);
-    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket);
+    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket, profilingService);
 
     ProfilingDynamicGuid childEntityGuid(0);
     ProfilingGuid parentEntityGuid(123);
@@ -187,7 +191,7 @@
     const std::string entityType = "some type";
 
     // Generate first guid to ensure that the named typed entity guid is not 0 on local single test.
-    ProfilingService::Instance().NextGuid();
+    profilingService.NextGuid();
 
     BOOST_CHECK_THROW(timelineUtilityMethods.CreateNamedTypedChildEntity(parentEntityGuid, "", entityType),
                       InvalidArgumentException);
@@ -276,11 +280,12 @@
 BOOST_AUTO_TEST_CASE(DeclareLabelTest)
 {
     MockBufferManager mockBufferManager(1024);
+    ProfilingService  profilingService;
     std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager);
-    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket);
+    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket, profilingService);
 
     // Generate first guid to ensure that the named typed entity guid is not 0 on local single test.
-    ProfilingService::Instance().NextGuid();
+    profilingService.NextGuid();
 
     // Try declaring an invalid (empty) label
     BOOST_CHECK_THROW(timelineUtilityMethods.DeclareLabel(""), InvalidArgumentException);
@@ -304,8 +309,9 @@
 BOOST_AUTO_TEST_CASE(CreateNameTypeEntityInvalidTest)
 {
     MockBufferManager mockBufferManager(1024);
+    ProfilingService  profilingService;
     std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager);
-    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket);
+    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket, profilingService);
 
     // Invalid name
     BOOST_CHECK_THROW(timelineUtilityMethods.CreateNamedTypedEntity("", "Type"), InvalidArgumentException);
@@ -313,7 +319,7 @@
     // Invalid type
     BOOST_CHECK_THROW(timelineUtilityMethods.CreateNamedTypedEntity("Name", ""), InvalidArgumentException);
 
-    ProfilingDynamicGuid guid = ProfilingService::Instance().NextGuid();
+    ProfilingDynamicGuid guid = profilingService.NextGuid();
 
     // CreatedNamedTypedEntity with Guid - Invalid name
     BOOST_CHECK_THROW(timelineUtilityMethods.CreateNamedTypedEntity(guid, "", "Type"),
@@ -328,14 +334,15 @@
 BOOST_AUTO_TEST_CASE(CreateNameTypeEntityTest)
 {
     MockBufferManager mockBufferManager(1024);
+    ProfilingService  profilingService;
     std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager);
-    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket);
+    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket, profilingService);
 
     const std::string entityName = "Entity0";
     const std::string entityType = "Type0";
 
     // Generate first guid to ensure that the named typed entity guid is not 0 on local single test.
-    ProfilingService::Instance().NextGuid();
+    profilingService.NextGuid();
 
     ProfilingDynamicGuid guid = timelineUtilityMethods.CreateNamedTypedEntity(entityName, entityType);
     BOOST_CHECK(guid != ProfilingGuid(0));
@@ -407,10 +414,11 @@
 BOOST_AUTO_TEST_CASE(RecordEventTest)
 {
     MockBufferManager mockBufferManager(1024);
+    ProfilingService  profilingService;
     std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = std::make_unique<SendTimelinePacket>(mockBufferManager);
-    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket);
+    TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket, profilingService);
     // Generate first guid to ensure that the named typed entity guid is not 0 on local single test.
-    ProfilingService::Instance().NextGuid();
+    profilingService.NextGuid();
 
     ProfilingGuid entityGuid(123);
     ProfilingStaticGuid eventClassGuid(456);