aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Flynn <jim.flynn@arm.com>2022-03-02 11:04:47 +0000
committerJim Flynn <jim.flynn@arm.com>2022-03-03 14:55:15 +0000
commitaf947729dc2aa7cdb6d4a716e2edf307710a8155 (patch)
tree87945dbee99d430032b27d2f6ee7a9975cb870ba
parent2b679db94a0f95861b47df6bb02d2992cf6d5af6 (diff)
downloadarmnn-af947729dc2aa7cdb6d4a716e2edf307710a8155.tar.gz
IVGCVSW-6811 replace ProfilingService includes with IProfilingService
Change-Id: I00521756c8a19d10bfdc98c6ef4204c7f84901c6 Signed-off-by: Jim Flynn <jim.flynn@arm.com>
-rw-r--r--Android.mk1
-rw-r--r--CMakeLists.txt3
-rw-r--r--include/armnn/BackendRegistry.hpp6
-rw-r--r--include/armnn/backends/Workload.hpp4
-rw-r--r--include/armnn/profiling/ArmNNProfiling.hpp22
-rw-r--r--profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp4
-rw-r--r--src/armnn/BackendRegistry.cpp5
-rw-r--r--src/armnn/Layer.cpp4
-rw-r--r--src/armnn/LoadedNetwork.cpp25
-rw-r--r--src/armnn/LoadedNetwork.hpp9
-rw-r--r--src/armnn/Network.cpp8
-rw-r--r--src/armnn/Runtime.cpp28
-rw-r--r--src/armnn/Runtime.hpp6
-rw-r--r--src/armnnTestUtils/TestUtils.cpp6
-rw-r--r--src/armnnTestUtils/TestUtils.hpp4
-rw-r--r--src/profiling/IProfilingService.cpp49
-rw-r--r--src/profiling/IProfilingService.hpp37
-rw-r--r--src/profiling/ProfilingService.cpp27
-rw-r--r--src/profiling/ProfilingService.hpp43
-rw-r--r--src/profiling/ProfilingState.hpp24
-rw-r--r--src/profiling/ProfilingStateMachine.hpp11
-rw-r--r--src/profiling/RegisterBackendCounters.hpp8
-rw-r--r--src/profiling/TimelineUtilityMethods.cpp26
-rw-r--r--src/profiling/TimelineUtilityMethods.hpp4
-rw-r--r--src/profiling/backends/BackendProfiling.hpp4
-rw-r--r--src/profiling/test/ProfilingTestUtils.hpp9
26 files changed, 228 insertions, 149 deletions
diff --git a/Android.mk b/Android.mk
index 688a188546..fde489fb1f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -243,6 +243,7 @@ LOCAL_SRC_FILES := \
src/profiling/DirectoryCaptureCommandHandler.cpp \
src/profiling/FileOnlyProfilingConnection.cpp \
src/profiling/Holder.cpp \
+ src/profiling/IProfilingService.cpp \
src/profiling/PacketBuffer.cpp \
src/profiling/PeriodicCounterCapture.cpp \
src/profiling/PeriodicCounterSelectionCommandHandler.cpp \
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7cb957ea20..16f018843d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -448,6 +448,8 @@ list(APPEND armnn_sources
src/profiling/IPacketBuffer.hpp
src/profiling/IPeriodicCounterCapture.hpp
src/profiling/IProfilingConnection.hpp
+ src/profiling/IProfilingService.cpp
+ src/profiling/IProfilingService.hpp
src/profiling/IProfilingConnectionFactory.hpp
src/profiling/NullProfilingConnection.hpp
src/profiling/PacketBuffer.cpp
@@ -464,6 +466,7 @@ list(APPEND armnn_sources
src/profiling/ProfilingConnectionFactory.hpp
src/profiling/ProfilingService.cpp
src/profiling/ProfilingService.hpp
+ src/profiling/ProfilingState.hpp
src/profiling/ProfilingStateMachine.cpp
src/profiling/ProfilingStateMachine.hpp
src/profiling/ProfilingUtils.cpp
diff --git a/include/armnn/BackendRegistry.hpp b/include/armnn/BackendRegistry.hpp
index 08e164c549..40a117ea48 100644
--- a/include/armnn/BackendRegistry.hpp
+++ b/include/armnn/BackendRegistry.hpp
@@ -20,7 +20,7 @@ namespace arm
namespace pipe
{
-class ProfilingService;
+class IProfilingService;
} // namespace arm
} // namespace pipe
@@ -44,7 +44,7 @@ public:
size_t Size() const;
BackendIdSet GetBackendIds() const;
std::string GetBackendIdsAsString() const;
- void SetProfilingService(armnn::Optional<arm::pipe::ProfilingService&> profilingService);
+ void SetProfilingService(armnn::Optional<arm::pipe::IProfilingService&> profilingService);
void RegisterAllocator(const BackendId& id, std::shared_ptr<ICustomAllocator> alloc);
std::unordered_map<BackendId, std::shared_ptr<ICustomAllocator>> GetAllocators();
void RegisterMemoryOptimizerStrategy(const BackendId& id, std::shared_ptr<IMemoryOptimizerStrategy> strategy);
@@ -78,7 +78,7 @@ private:
BackendRegistry& operator=(const BackendRegistry&) = delete;
FactoryStorage m_Factories;
- armnn::Optional<arm::pipe::ProfilingService&> m_ProfilingService;
+ armnn::Optional<arm::pipe::IProfilingService&> m_ProfilingService;
std::unordered_map<BackendId, std::shared_ptr<ICustomAllocator>> m_CustomMemoryAllocatorMap;
std::unordered_map<BackendId, std::shared_ptr<IMemoryOptimizerStrategy>> m_MemoryOptimizerStrategyMap;
};
diff --git a/include/armnn/backends/Workload.hpp b/include/armnn/backends/Workload.hpp
index ddcc5a8f0a..7ffd5c57fb 100644
--- a/include/armnn/backends/Workload.hpp
+++ b/include/armnn/backends/Workload.hpp
@@ -10,7 +10,7 @@
#include "WorkingMemDescriptor.hpp"
#include <Profiling.hpp>
-#include <ProfilingService.hpp>
+#include <IProfilingService.hpp>
#include <algorithm>
@@ -32,7 +32,7 @@ public:
BaseWorkload(const QueueDescriptor& descriptor, const WorkloadInfo& info)
: m_Data(descriptor),
- m_Guid(arm::pipe::ProfilingService::GetNextGuid())
+ m_Guid(arm::pipe::IProfilingService::GetNextGuid())
{
m_Data.Validate(info);
}
diff --git a/include/armnn/profiling/ArmNNProfiling.hpp b/include/armnn/profiling/ArmNNProfiling.hpp
new file mode 100644
index 0000000000..39d4a6bfcc
--- /dev/null
+++ b/include/armnn/profiling/ArmNNProfiling.hpp
@@ -0,0 +1,22 @@
+//
+// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+namespace arm
+{
+
+namespace pipe
+{
+// Static constants describing ArmNN's counter UID's
+static const uint16_t NETWORK_LOADS = 0;
+static const uint16_t NETWORK_UNLOADS = 1;
+static const uint16_t REGISTERED_BACKENDS = 2;
+static const uint16_t UNREGISTERED_BACKENDS = 3;
+static const uint16_t INFERENCES_RUN = 4;
+static const uint16_t MAX_ARMNN_COUNTER = INFERENCES_RUN;
+} // namespace pipe
+
+} // namespace arm
diff --git a/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp b/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp
index 03de76911e..a0af25fc65 100644
--- a/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp
+++ b/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp
@@ -5,6 +5,8 @@
#include <server/include/basePipeServer/ConnectionHandler.hpp>
+#include <BufferManager.hpp>
+#include <SendCounterPacket.hpp>
#include <SocketProfilingConnection.hpp>
#include <Processes.hpp>
@@ -94,4 +96,4 @@ TEST_CASE("BasePipeServerTest")
socketProfilingConnection.Close();
}
-} \ No newline at end of file
+}
diff --git a/src/armnn/BackendRegistry.cpp b/src/armnn/BackendRegistry.cpp
index 7b1f6bcb5d..01f632fb22 100644
--- a/src/armnn/BackendRegistry.cpp
+++ b/src/armnn/BackendRegistry.cpp
@@ -5,7 +5,8 @@
#include <armnn/BackendRegistry.hpp>
#include <armnn/Exceptions.hpp>
-#include <ProfilingService.hpp>
+#include <armnn/profiling/ArmNNProfiling.hpp>
+#include <IProfilingService.hpp>
namespace armnn
{
@@ -102,7 +103,7 @@ void BackendRegistry::Swap(BackendRegistry& instance, BackendRegistry::FactorySt
std::swap(instance.m_Factories, other);
}
-void BackendRegistry::SetProfilingService(armnn::Optional<arm::pipe::ProfilingService&> profilingService)
+void BackendRegistry::SetProfilingService(armnn::Optional<arm::pipe::IProfilingService&> profilingService)
{
m_ProfilingService = profilingService;
}
diff --git a/src/armnn/Layer.cpp b/src/armnn/Layer.cpp
index c827b4b681..5818eefa39 100644
--- a/src/armnn/Layer.cpp
+++ b/src/armnn/Layer.cpp
@@ -5,7 +5,7 @@
#include "Layer.hpp"
#include "Graph.hpp"
-#include <ProfilingService.hpp>
+#include <IProfilingService.hpp>
#include <armnn/utility/NumericCast.hpp>
#include <armnn/backends/TensorHandle.hpp>
#include <armnn/backends/WorkloadData.hpp>
@@ -202,7 +202,7 @@ Layer::Layer(unsigned int numInputSlots,
, m_Type(type)
, m_BackendId()
, m_BackendHint(EmptyOptional())
-, m_Guid(arm::pipe::ProfilingService::GetNextGuid())
+, m_Guid(arm::pipe::IProfilingService::GetNextGuid())
{
IgnoreUnused(layout);
m_InputSlots.reserve(numInputSlots);
diff --git a/src/armnn/LoadedNetwork.cpp b/src/armnn/LoadedNetwork.cpp
index 1367552f98..1dbd1e3112 100644
--- a/src/armnn/LoadedNetwork.cpp
+++ b/src/armnn/LoadedNetwork.cpp
@@ -20,6 +20,7 @@
#include <armnn/backends/MemCopyWorkload.hpp>
#include <backendsCommon/MemSyncWorkload.hpp>
#include <armnn/BackendHelper.hpp>
+#include <armnn/profiling/ArmNNProfiling.hpp>
#include <fmt/format.h>
@@ -82,7 +83,7 @@ void AddWorkloadStructure(std::unique_ptr<TimelineUtilityMethods>& timelineUtils
std::unique_ptr<LoadedNetwork> LoadedNetwork::MakeLoadedNetwork(std::unique_ptr<IOptimizedNetwork> net,
std::string& errorMessage,
const INetworkProperties& networkProperties,
- ProfilingService& profilingService)
+ arm::pipe::IProfilingService* profilingService)
{
std::unique_ptr<LoadedNetwork> loadedNetwork;
@@ -116,7 +117,7 @@ std::unique_ptr<LoadedNetwork> LoadedNetwork::MakeLoadedNetwork(std::unique_ptr<
LoadedNetwork::LoadedNetwork(std::unique_ptr<IOptimizedNetwork> net,
const INetworkProperties& networkProperties,
- ProfilingService& profilingService) :
+ arm::pipe::IProfilingService* profilingService) :
m_OptimizedNetwork(std::move(net)),
m_NetworkProperties(networkProperties),
m_TensorHandleFactoryRegistry(),
@@ -254,7 +255,7 @@ LoadedNetwork::LoadedNetwork(std::unique_ptr<IOptimizedNetwork> net,
ProfilingGuid networkGuid = m_OptimizedNetwork->GetGuid();
std::unique_ptr<TimelineUtilityMethods> timelineUtils =
- TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
+ TimelineUtilityMethods::GetTimelineUtils(*m_ProfilingService);
if (timelineUtils)
{
timelineUtils->CreateTypedEntity(networkGuid, LabelsAndEventClasses::NETWORK_GUID);
@@ -549,7 +550,7 @@ void LoadedNetwork::SendNetworkStructure()
ProfilingGuid networkGuid = m_OptimizedNetwork->GetGuid();
std::unique_ptr<TimelineUtilityMethods> timelineUtils =
- TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
+ TimelineUtilityMethods::GetTimelineUtils(*m_ProfilingService);
timelineUtils->CreateTypedEntity(networkGuid, LabelsAndEventClasses::NETWORK_GUID);
@@ -893,8 +894,8 @@ Status LoadedNetwork::EnqueueWorkload(const InputTensors& inputTensors,
}
std::unique_ptr<TimelineUtilityMethods> timelineUtils =
- TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
- ProfilingGuid inferenceGuid = m_ProfilingService.GetNextGuid();
+ TimelineUtilityMethods::GetTimelineUtils(*m_ProfilingService);
+ ProfilingGuid inferenceGuid = m_ProfilingService->GetNextGuid();
if (timelineUtils)
{
// Add inference timeline trace if profiling is enabled.
@@ -910,9 +911,9 @@ Status LoadedNetwork::EnqueueWorkload(const InputTensors& inputTensors,
bool executionSucceeded = true;
{
- if (m_ProfilingService.IsProfilingEnabled())
+ if (m_ProfilingService->IsProfilingEnabled())
{
- m_ProfilingService.IncrementCounterValue(INFERENCES_RUN);
+ m_ProfilingService->IncrementCounterValue(INFERENCES_RUN);
}
ARMNN_SCOPED_PROFILING_EVENT(Compute::Undefined, "Execute");
ARMNN_SCOPED_HEAP_PROFILING("Executing");
@@ -982,7 +983,7 @@ void LoadedNetwork::EnqueueInput(const BindableLayer& layer, ITensorHandle* tens
ARMNN_ASSERT_MSG(inputWorkload, "No input workload created");
std::unique_ptr<TimelineUtilityMethods> timelineUtils =
- TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
+ TimelineUtilityMethods::GetTimelineUtils(*m_ProfilingService);
if (timelineUtils)
{
// Add Input Workload to the post-optimisation network structure
@@ -1070,7 +1071,7 @@ void LoadedNetwork::EnqueueOutput(const BindableLayer& layer, ITensorHandle* ten
ARMNN_ASSERT_MSG(outputWorkload, "No output workload created");
std::unique_ptr<TimelineUtilityMethods> timelineUtils =
- TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
+ TimelineUtilityMethods::GetTimelineUtils(*m_ProfilingService);
if (timelineUtils)
{
// Add Output Workload to the post-optimisation network structure
@@ -1683,8 +1684,8 @@ Status LoadedNetwork::Execute(const InputTensors& inputTensors,
};
std::unique_ptr<TimelineUtilityMethods> timelineUtils =
- TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
- ProfilingGuid inferenceGuid = m_ProfilingService.GetNextGuid();
+ TimelineUtilityMethods::GetTimelineUtils(*m_ProfilingService);
+ ProfilingGuid inferenceGuid = m_ProfilingService->GetNextGuid();
if (timelineUtils)
{
// Add inference timeline trace if profiling is enabled.
diff --git a/src/armnn/LoadedNetwork.hpp b/src/armnn/LoadedNetwork.hpp
index 09d760454e..19f2bcf907 100644
--- a/src/armnn/LoadedNetwork.hpp
+++ b/src/armnn/LoadedNetwork.hpp
@@ -19,7 +19,7 @@
#include <backendsCommon/memoryOptimizerStrategyLibrary/strategies/SingleAxisPriorityList.hpp>
-#include <ProfilingService.hpp>
+#include <IProfilingService.hpp>
#include <TimelineUtilityMethods.hpp>
#include <common/include/LabelsAndEventClasses.hpp>
@@ -78,7 +78,7 @@ public:
static std::unique_ptr<LoadedNetwork> MakeLoadedNetwork(std::unique_ptr<IOptimizedNetwork> net,
std::string& errorMessage,
const INetworkProperties& networkProperties,
- arm::pipe::ProfilingService& profilingService);
+ arm::pipe::IProfilingService* profilingService);
// NOTE we return by reference as the purpose of this method is only to provide
// access to the private m_Profiler and in theory we should not need to increment
@@ -112,7 +112,7 @@ private:
LoadedNetwork(std::unique_ptr<IOptimizedNetwork> net,
const INetworkProperties& networkProperties,
- arm::pipe::ProfilingService& profilingService);
+ arm::pipe::IProfilingService* profilingService);
void EnqueueInput(const BindableLayer& layer, ITensorHandle* tensorHandle, const TensorInfo& tensorInfo);
@@ -158,7 +158,8 @@ private:
TensorHandleFactoryRegistry m_TensorHandleFactoryRegistry;
- arm::pipe::ProfilingService& m_ProfilingService;
+ // NOTE: raw pointer because the profiling service is controlled by the Runtime
+ arm::pipe::IProfilingService* m_ProfilingService;
struct ImportedTensorHandlePin
{
diff --git a/src/armnn/Network.cpp b/src/armnn/Network.cpp
index 498c4a72ad..58e8b503ee 100644
--- a/src/armnn/Network.cpp
+++ b/src/armnn/Network.cpp
@@ -26,7 +26,7 @@
#include <armnn/utility/IgnoreUnused.hpp>
#include <armnn/utility/PolymorphicDowncast.hpp>
-#include <ProfilingService.hpp>
+#include <IProfilingService.hpp>
#include <common/include/ProfilingGuid.hpp>
@@ -2866,18 +2866,18 @@ void NetworkImpl::ExecuteStrategy(IStrategy& strategy) const
OptimizedNetworkImpl::OptimizedNetworkImpl(const OptimizedNetworkImpl& other, const ModelOptions& modelOptions)
: m_Graph(new Graph(*other.m_Graph.get()))
- , m_Guid(arm::pipe::ProfilingService::GetNextGuid())
+ , m_Guid(arm::pipe::IProfilingService::GetNextGuid())
, m_ModelOptions(modelOptions)
{
}
OptimizedNetworkImpl::OptimizedNetworkImpl(std::unique_ptr<Graph> graph)
- : m_Graph(std::move(graph)), m_Guid(arm::pipe::ProfilingService::GetNextGuid())
+ : m_Graph(std::move(graph)), m_Guid(arm::pipe::IProfilingService::GetNextGuid())
{
}
OptimizedNetworkImpl::OptimizedNetworkImpl(std::unique_ptr<Graph> graph, const ModelOptions& modelOptions)
- : m_Graph(std::move(graph)), m_Guid(arm::pipe::ProfilingService::GetNextGuid()), m_ModelOptions(modelOptions)
+ : m_Graph(std::move(graph)), m_Guid(arm::pipe::IProfilingService::GetNextGuid()), m_ModelOptions(modelOptions)
{
}
diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp
index 640e5947e2..4cc34ff6ac 100644
--- a/src/armnn/Runtime.cpp
+++ b/src/armnn/Runtime.cpp
@@ -185,7 +185,7 @@ Status RuntimeImpl::LoadNetwork(NetworkId& networkIdOut,
std::unique_ptr<IOptimizedNetwork>(rawNetwork),
errorMessage,
networkProperties,
- m_ProfilingService);
+ m_ProfilingService.get());
if (!loadedNetwork)
{
@@ -204,9 +204,9 @@ Status RuntimeImpl::LoadNetwork(NetworkId& networkIdOut,
context.second->AfterLoadNetwork(networkIdOut);
}
- if (m_ProfilingService.IsProfilingEnabled())
+ if (m_ProfilingService->IsProfilingEnabled())
{
- m_ProfilingService.IncrementCounterValue(arm::pipe::NETWORK_LOADS);
+ m_ProfilingService->IncrementCounterValue(arm::pipe::NETWORK_LOADS);
}
return Status::Success;
@@ -228,7 +228,7 @@ Status RuntimeImpl::UnloadNetwork(NetworkId networkId)
}
std::unique_ptr<arm::pipe::TimelineUtilityMethods> timelineUtils =
- arm::pipe::TimelineUtilityMethods::GetTimelineUtils(m_ProfilingService);
+ arm::pipe::TimelineUtilityMethods::GetTimelineUtils(*m_ProfilingService.get());
{
std::lock_guard<std::mutex> lockGuard(m_Mutex);
@@ -250,9 +250,9 @@ Status RuntimeImpl::UnloadNetwork(NetworkId networkId)
return Status::Failure;
}
- if (m_ProfilingService.IsProfilingEnabled())
+ if (m_ProfilingService->IsProfilingEnabled())
{
- m_ProfilingService.IncrementCounterValue(arm::pipe::NETWORK_UNLOADS);
+ m_ProfilingService->IncrementCounterValue(arm::pipe::NETWORK_UNLOADS);
}
}
@@ -296,9 +296,9 @@ void RuntimeImpl::ReportStructure() // arm::pipe::IProfilingService& profilingSe
}
RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
- : m_NetworkIdCounter(0),
- m_ProfilingService(*this)
+ : m_NetworkIdCounter(0)
{
+ m_ProfilingService = arm::pipe::IProfilingService::CreateProfilingService(*this);
const auto start_time = armnn::GetTimeNow();
ARMNN_LOG(info) << "ArmNN v" << ARMNN_VERSION;
if ( options.m_ProfilingOptions.m_TimelineEnabled && !options.m_ProfilingOptions.m_EnableProfiling )
@@ -475,7 +475,9 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
unique_ptr<arm::pipe::IBackendProfiling> profilingIface =
std::make_unique<arm::pipe::BackendProfiling>(arm::pipe::BackendProfiling(
- arm::pipe::ConvertExternalProfilingOptions(options.m_ProfilingOptions), m_ProfilingService, id));
+ arm::pipe::ConvertExternalProfilingOptions(options.m_ProfilingOptions),
+ *m_ProfilingService.get(),
+ id));
// Backends may also provide a profiling context. Ask for it now.
auto profilingContext = backend->CreateBackendProfilingContext(options, profilingIface);
@@ -483,7 +485,7 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
if (profilingContext)
{
// Pass the context onto the profiling service.
- m_ProfilingService.AddBackendProfilingContext(id, profilingContext);
+ m_ProfilingService->AddBackendProfilingContext(id, profilingContext);
}
}
catch (const BackendUnavailableException&)
@@ -492,14 +494,14 @@ RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options)
}
}
- BackendRegistryInstance().SetProfilingService(m_ProfilingService);
+ BackendRegistryInstance().SetProfilingService(*m_ProfilingService.get());
// pass configuration info to the profiling service
- m_ProfilingService.ConfigureProfilingService(
+ m_ProfilingService->ConfigureProfilingService(
arm::pipe::ConvertExternalProfilingOptions(options.m_ProfilingOptions));
if (options.m_ProfilingOptions.m_EnableProfiling)
{
// try to wait for the profiling service to initialise
- m_ProfilingService.WaitForProfilingServiceActivation(3000);
+ m_ProfilingService->WaitForProfilingServiceActivation(3000);
}
m_DeviceSpec.AddSupportedBackends(supportedBackends);
diff --git a/src/armnn/Runtime.hpp b/src/armnn/Runtime.hpp
index 1ac0d21b63..a8fa5fd5c5 100644
--- a/src/armnn/Runtime.hpp
+++ b/src/armnn/Runtime.hpp
@@ -14,8 +14,6 @@
#include <armnn/backends/DynamicBackend.hpp>
-#include <ProfilingService.hpp>
-
#include <IProfilingService.hpp>
#include <IReportStructure.hpp>
@@ -115,7 +113,7 @@ public:
private:
friend void RuntimeLoadedNetworksReserve(RuntimeImpl* runtime); // See RuntimeTests.cpp
- friend arm::pipe::ProfilingService& GetProfilingService(RuntimeImpl* runtime); // See RuntimeTests.cpp
+ friend arm::pipe::IProfilingService& GetProfilingService(RuntimeImpl* runtime); // See RuntimeTests.cpp
int GenerateNetworkId();
@@ -150,7 +148,7 @@ private:
std::vector<DynamicBackendPtr> m_DynamicBackends;
/// Profiling Service Instance
- arm::pipe::ProfilingService m_ProfilingService;
+ std::unique_ptr<arm::pipe::IProfilingService> m_ProfilingService;
};
} // namespace armnn
diff --git a/src/armnnTestUtils/TestUtils.cpp b/src/armnnTestUtils/TestUtils.cpp
index 7c9fc909ac..a67eecfd03 100644
--- a/src/armnnTestUtils/TestUtils.cpp
+++ b/src/armnnTestUtils/TestUtils.cpp
@@ -56,9 +56,9 @@ ModelOptions& GetModelOptionsForTesting(IOptimizedNetwork* optNet)
return optNet->pOptimizedNetworkImpl->GetModelOptions();
}
-arm::pipe::ProfilingService& GetProfilingService(armnn::RuntimeImpl* runtime)
+arm::pipe::IProfilingService& GetProfilingService(armnn::RuntimeImpl* runtime)
{
- return runtime->m_ProfilingService;
+ return *(runtime->m_ProfilingService.get());
}
-} \ No newline at end of file
+}
diff --git a/src/armnnTestUtils/TestUtils.hpp b/src/armnnTestUtils/TestUtils.hpp
index 5433d93332..9fea61b264 100644
--- a/src/armnnTestUtils/TestUtils.hpp
+++ b/src/armnnTestUtils/TestUtils.hpp
@@ -53,6 +53,6 @@ namespace armnn
{
Graph& GetGraphForTesting(IOptimizedNetwork* optNetPtr);
ModelOptions& GetModelOptionsForTesting(IOptimizedNetwork* optNetPtr);
-arm::pipe::ProfilingService& GetProfilingService(RuntimeImpl* runtime);
+arm::pipe::IProfilingService& GetProfilingService(RuntimeImpl* runtime);
-} // namespace armnn \ No newline at end of file
+} // namespace armnn
diff --git a/src/profiling/IProfilingService.cpp b/src/profiling/IProfilingService.cpp
new file mode 100644
index 0000000000..9b1aac5a4e
--- /dev/null
+++ b/src/profiling/IProfilingService.cpp
@@ -0,0 +1,49 @@
+//
+// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "IProfilingService.hpp"
+#include "ProfilingService.hpp"
+
+namespace arm
+{
+
+namespace pipe
+{
+
+std::unique_ptr<IProfilingService> IProfilingService::CreateProfilingService(
+ armnn::Optional<IReportStructure&> reportStructure)
+{
+ return std::make_unique<ProfilingService>(reportStructure);
+}
+
+ProfilingGuidGenerator IProfilingService::m_GuidGenerator;
+
+ProfilingDynamicGuid IProfilingService::GetNextGuid()
+{
+ return m_GuidGenerator.NextGuid();
+}
+
+ProfilingStaticGuid IProfilingService::GetStaticId(const std::string& str)
+{
+ return m_GuidGenerator.GenerateStaticId(str);
+}
+
+void IProfilingService::ResetGuidGenerator()
+{
+ m_GuidGenerator.Reset();
+}
+
+ProfilingDynamicGuid IProfilingService::NextGuid()
+{
+ return IProfilingService::GetNextGuid();
+}
+
+ProfilingStaticGuid IProfilingService::GenerateStaticId(const std::string& str)
+{
+ return IProfilingService::GetStaticId(str);
+}
+
+} // namespace pipe
+} // namespace arm
diff --git a/src/profiling/IProfilingService.hpp b/src/profiling/IProfilingService.hpp
index c2e824e6f5..31d9b8d1e3 100644
--- a/src/profiling/IProfilingService.hpp
+++ b/src/profiling/IProfilingService.hpp
@@ -7,9 +7,16 @@
#include "CounterIdMap.hpp"
#include "Holder.hpp"
+#include "ICounterValues.hpp"
+#include "ICounterRegistry.hpp"
#include "IProfilingServiceStatus.hpp"
#include "ISendCounterPacket.hpp"
+#include "IReportStructure.hpp"
+#include "ProfilingState.hpp"
+#include <armnn/backends/profiling/IBackendProfilingContext.hpp>
+#include <armnn/profiling/ProfilingOptions.hpp>
+#include <armnn/Optional.hpp>
#include <common/include/ProfilingGuidGenerator.hpp>
namespace arm
@@ -18,18 +25,44 @@ namespace arm
namespace pipe
{
-class IProfilingService : public IProfilingGuidGenerator, public IProfilingServiceStatus
+class IProfilingService : public IProfilingGuidGenerator,
+ public IProfilingServiceStatus,
+ public IReadWriteCounterValues
{
public:
+ static std::unique_ptr<IProfilingService> CreateProfilingService(
+ armnn::Optional<IReportStructure&> reportStructure = armnn::EmptyOptional());
virtual ~IProfilingService() {};
virtual std::unique_ptr<ISendTimelinePacket> GetSendTimelinePacket() const = 0;
virtual const ICounterMappings& GetCounterMappings() const = 0;
virtual ISendCounterPacket& GetSendCounterPacket() = 0;
virtual bool IsProfilingEnabled() const = 0;
+ virtual bool IsTimelineReportingEnabled() const = 0;
virtual CaptureData GetCaptureData() = 0;
+ virtual ProfilingState GetCurrentState() const = 0;
+ // Resets the profiling options, optionally clears the profiling service entirely
+ virtual void ResetExternalProfilingOptions(const ProfilingOptions& options,
+ bool resetProfilingService = false) = 0;
+ virtual ProfilingState ConfigureProfilingService(const ProfilingOptions& options,
+ bool resetProfilingService = false) = 0;
+ // Store a profiling context returned from a backend that support profiling.
+ virtual void AddBackendProfilingContext(const armnn::BackendId backendId,
+ std::shared_ptr<IBackendProfilingContext> profilingContext) = 0;
+ virtual ICounterRegistry& GetCounterRegistry() = 0;
+ virtual IRegisterCounterMapping& GetCounterMappingRegistry() = 0;
+ // 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;
+ static ProfilingDynamicGuid GetNextGuid();
+ static ProfilingStaticGuid GetStaticId(const std::string& str);
+ void ResetGuidGenerator();
+
+private:
+ static ProfilingGuidGenerator m_GuidGenerator;
};
} // namespace pipe
} // namespace arm
-
diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
index cef8a6d9ea..2e67dc870d 100644
--- a/src/profiling/ProfilingService.cpp
+++ b/src/profiling/ProfilingService.cpp
@@ -21,23 +21,6 @@ namespace arm
namespace pipe
{
-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::ResetGuidGenerator()
-{
- m_GuidGenerator.Reset();
-}
-
void ProfilingService::ResetExternalProfilingOptions(const arm::pipe::ProfilingOptions& options,
bool resetProfilingService)
{
@@ -316,16 +299,6 @@ uint32_t ProfilingService::IncrementCounterValue(uint16_t counterUid)
return counterValuePtr->operator++(std::memory_order::memory_order_relaxed);
}
-ProfilingDynamicGuid ProfilingService::NextGuid()
-{
- return ProfilingService::GetNextGuid();
-}
-
-ProfilingStaticGuid ProfilingService::GenerateStaticId(const std::string& str)
-{
- return ProfilingService::GetStaticId(str);
-}
-
std::unique_ptr<ISendTimelinePacket> ProfilingService::GetSendTimelinePacket() const
{
return m_TimelinePacketWriterFactory.GetSendTimelinePacket();
diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp
index ab71b0c768..a4b02c10ad 100644
--- a/src/profiling/ProfilingService.hpp
+++ b/src/profiling/ProfilingService.hpp
@@ -15,7 +15,6 @@
#include "ICounterRegistry.hpp"
#include "ICounterValues.hpp"
#include <armnn/profiling/ILocalPacketHandler.hpp>
-#include <armnn/profiling/ProfilingOptions.hpp>
#include "IProfilingService.hpp"
#include "IReportStructure.hpp"
#include "PeriodicCounterCapture.hpp"
@@ -29,9 +28,9 @@
#include "SendTimelinePacket.hpp"
#include "TimelinePacketWriterFactory.hpp"
#include "INotifyBackends.hpp"
+#include <armnn/profiling/ArmNNProfiling.hpp>
#include <armnn/backends/profiling/IBackendProfilingContext.hpp>
-#include <common/include/ProfilingGuidGenerator.hpp>
#include <list>
@@ -40,15 +39,8 @@ namespace arm
namespace pipe
{
-// Static constants describing ArmNN's counter UID's
-static const uint16_t NETWORK_LOADS = 0;
-static const uint16_t NETWORK_UNLOADS = 1;
-static const uint16_t REGISTERED_BACKENDS = 2;
-static const uint16_t UNREGISTERED_BACKENDS = 3;
-static const uint16_t INFERENCES_RUN = 4;
-static const uint16_t MAX_ARMNN_COUNTER = INFERENCES_RUN;
-
-class ProfilingService : public IReadWriteCounterValues, public IProfilingService, public INotifyBackends
+
+class ProfilingService : public IProfilingService, public INotifyBackends
{
public:
using IProfilingConnectionFactoryPtr = std::unique_ptr<IProfilingConnectionFactory>;
@@ -150,9 +142,9 @@ public:
// Resets the profiling options, optionally clears the profiling service entirely
void ResetExternalProfilingOptions(const ProfilingOptions& options,
- bool resetProfilingService = false);
+ bool resetProfilingService = false) override;
ProfilingState ConfigureProfilingService(const ProfilingOptions& options,
- bool resetProfilingService = false);
+ bool resetProfilingService = false) override;
// Updates the profiling service, making it transition to a new state if necessary
@@ -163,21 +155,21 @@ public:
// Store a profiling context returned from a backend that support profiling.
void AddBackendProfilingContext(const armnn::BackendId backendId,
- std::shared_ptr<IBackendProfilingContext> profilingContext);
+ std::shared_ptr<IBackendProfilingContext> profilingContext) override;
// Enable the recording of timeline events and entities
void NotifyBackendsForTimelineReporting() override;
const ICounterDirectory& GetCounterDirectory() const;
- ICounterRegistry& GetCounterRegistry();
- ProfilingState GetCurrentState() const;
+ ICounterRegistry& GetCounterRegistry() override;
+ ProfilingState GetCurrentState() const override;
bool IsCounterRegistered(uint16_t counterUid) const override;
uint32_t GetAbsoluteCounterValue(uint16_t counterUid) const override;
uint32_t GetDeltaCounterValue(uint16_t counterUid) override;
uint16_t GetCounterCount() const override;
// counter global/backend mapping functions
const ICounterMappings& GetCounterMappings() const override;
- IRegisterCounterMapping& GetCounterMappingRegistry();
+ IRegisterCounterMapping& GetCounterMappingRegistry() override;
// Getters for the profiling service state
bool IsProfilingEnabled() const override;
@@ -193,13 +185,6 @@ public:
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
@@ -207,13 +192,7 @@ public:
return m_SendCounterPacket;
}
- static ProfilingDynamicGuid GetNextGuid();
-
- static ProfilingStaticGuid GetStaticId(const std::string& str);
-
- void ResetGuidGenerator();
-
- bool IsTimelineReportingEnabled()
+ bool IsTimelineReportingEnabled() const override
{
return m_TimelineReporting;
}
@@ -272,8 +251,6 @@ private:
BackendProfilingContext m_BackendProfilingContexts;
uint16_t m_MaxGlobalCounterId;
- static ProfilingGuidGenerator m_GuidGenerator;
-
// Signalling to let external actors know when service is active or not
std::mutex m_ServiceActiveMutex;
std::condition_variable m_ServiceActiveConditionVariable;
diff --git a/src/profiling/ProfilingState.hpp b/src/profiling/ProfilingState.hpp
new file mode 100644
index 0000000000..0fc1903118
--- /dev/null
+++ b/src/profiling/ProfilingState.hpp
@@ -0,0 +1,24 @@
+//
+// Copyright © 2022 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+namespace arm
+{
+
+namespace pipe
+{
+
+enum class ProfilingState
+{
+ Uninitialised,
+ NotConnected,
+ WaitingForAck,
+ Active
+};
+
+} // namespace pipe
+
+} // namespace arm
diff --git a/src/profiling/ProfilingStateMachine.hpp b/src/profiling/ProfilingStateMachine.hpp
index 2980556ca8..2648bcaba0 100644
--- a/src/profiling/ProfilingStateMachine.hpp
+++ b/src/profiling/ProfilingStateMachine.hpp
@@ -5,6 +5,8 @@
#pragma once
+#include "ProfilingState.hpp"
+
#include <atomic>
#include <armnn/utility/IgnoreUnused.hpp>
@@ -15,14 +17,6 @@ namespace arm
namespace pipe
{
-enum class ProfilingState
-{
- Uninitialised,
- NotConnected,
- WaitingForAck,
- Active
-};
-
class ProfilingStateMachine
{
public:
@@ -71,4 +65,3 @@ constexpr char const* GetProfilingStateName(ProfilingState state)
} // namespace pipe
} // namespace arm
-
diff --git a/src/profiling/RegisterBackendCounters.hpp b/src/profiling/RegisterBackendCounters.hpp
index f25feb5306..34f9f3a3eb 100644
--- a/src/profiling/RegisterBackendCounters.hpp
+++ b/src/profiling/RegisterBackendCounters.hpp
@@ -8,7 +8,7 @@
#include "armnn/backends/profiling/IBackendProfiling.hpp"
#include "CounterIdMap.hpp"
#include "CounterDirectory.hpp"
-#include "ProfilingService.hpp"
+#include "IProfilingService.hpp"
namespace arm
{
@@ -21,7 +21,7 @@ class RegisterBackendCounters : public IRegisterBackendCounters
public:
RegisterBackendCounters(
- uint16_t currentMaxGlobalCounterID, const armnn::BackendId& backendId, ProfilingService& profilingService)
+ uint16_t currentMaxGlobalCounterID, const armnn::BackendId& backendId, IProfilingService& profilingService)
: m_CurrentMaxGlobalCounterID(currentMaxGlobalCounterID),
m_BackendId(backendId),
m_ProfilingService(profilingService),
@@ -55,10 +55,10 @@ public:
private:
uint16_t m_CurrentMaxGlobalCounterID;
const armnn::BackendId& m_BackendId;
- ProfilingService& m_ProfilingService;
+ IProfilingService& m_ProfilingService;
ICounterRegistry& m_CounterDirectory;
};
} // namespace pipe
-} // namespace arm \ No newline at end of file
+} // namespace arm
diff --git a/src/profiling/TimelineUtilityMethods.cpp b/src/profiling/TimelineUtilityMethods.cpp
index bc8e7b6ce8..fea8ed7ae0 100644
--- a/src/profiling/TimelineUtilityMethods.cpp
+++ b/src/profiling/TimelineUtilityMethods.cpp
@@ -15,7 +15,7 @@ namespace arm
namespace pipe
{
-std::unique_ptr<TimelineUtilityMethods> TimelineUtilityMethods::GetTimelineUtils(ProfilingService& profilingService)
+std::unique_ptr<TimelineUtilityMethods> TimelineUtilityMethods::GetTimelineUtils(IProfilingService& profilingService)
{
if (profilingService.GetCurrentState() == ProfilingState::Active && profilingService.IsTimelineReportingEnabled())
{
@@ -114,7 +114,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateNamedTypedEntity(const std::s
}
// Generate dynamic GUID of the entity
- ProfilingDynamicGuid entityGuid = ProfilingService::GetNextGuid();
+ ProfilingDynamicGuid entityGuid = IProfilingService::GetNextGuid();
CreateNamedTypedEntity(entityGuid, name, type);
@@ -177,7 +177,7 @@ ProfilingStaticGuid TimelineUtilityMethods::DeclareLabel(const std::string& labe
}
// Generate a static GUID for the given label name
- ProfilingStaticGuid labelGuid = ProfilingService::GetStaticId(labelName);
+ ProfilingStaticGuid labelGuid = IProfilingService::GetStaticId(labelName);
// Send the new label to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
@@ -200,7 +200,7 @@ void TimelineUtilityMethods::MarkEntityWithLabel(ProfilingGuid entityGuid,
ProfilingStaticGuid labelGuid = DeclareLabel(labelName);
// Generate a GUID for the label relationship
- ProfilingDynamicGuid relationshipGuid = ProfilingService::GetNextGuid();
+ ProfilingDynamicGuid relationshipGuid = IProfilingService::GetNextGuid();
// Send the new label link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
@@ -214,7 +214,7 @@ void TimelineUtilityMethods::MarkEntityWithType(ProfilingGuid entityGuid,
ProfilingStaticGuid typeNameGuid)
{
// Generate a GUID for the label relationship
- ProfilingDynamicGuid relationshipGuid = ProfilingService::GetNextGuid();
+ ProfilingDynamicGuid relationshipGuid = IProfilingService::GetNextGuid();
// Send the new label link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
@@ -256,7 +256,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateNamedTypedChildEntity(Profili
ProfilingDynamicGuid childEntityGuid = CreateNamedTypedEntity(entityName, entityType);
// Generate a GUID for the retention link relationship
- ProfilingDynamicGuid retentionLinkGuid = ProfilingService::GetNextGuid();
+ ProfilingDynamicGuid retentionLinkGuid = IProfilingService::GetNextGuid();
// Send the new retention link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
@@ -291,7 +291,7 @@ void TimelineUtilityMethods::CreateNamedTypedChildEntity(ProfilingGuid childEnti
CreateNamedTypedEntity(childEntityGuid, entityName, entityType);
// Generate a GUID for the retention link relationship
- ProfilingDynamicGuid retentionLinkGuid = ProfilingService::GetNextGuid();
+ ProfilingDynamicGuid retentionLinkGuid = IProfilingService::GetNextGuid();
// Send the new retention link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
@@ -317,7 +317,7 @@ void TimelineUtilityMethods::CreateNamedTypedChildEntity(ProfilingGuid childEnti
CreateNamedTypedEntity(childEntityGuid, entityName, typeGuid);
// Generate a GUID for the retention link relationship
- ProfilingDynamicGuid retentionLinkGuid = ProfilingService::GetNextGuid();
+ ProfilingDynamicGuid retentionLinkGuid = IProfilingService::GetNextGuid();
// Send the new retention link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
@@ -333,7 +333,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateRelationship(ProfilingRelatio
ProfilingGuid relationshipCategory)
{
// Generate a GUID for the relationship
- ProfilingDynamicGuid relationshipGuid = ProfilingService::GetNextGuid();
+ ProfilingDynamicGuid relationshipGuid = IProfilingService::GetNextGuid();
// Send the new retention link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
@@ -349,7 +349,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateConnectionRelationship(Profil
ProfilingGuid tailGuid)
{
// Generate a GUID for the relationship
- ProfilingDynamicGuid relationshipGuid = ProfilingService::GetNextGuid();
+ ProfilingDynamicGuid relationshipGuid = IProfilingService::GetNextGuid();
// Send the new retention link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
@@ -378,13 +378,13 @@ ProfilingDynamicGuid TimelineUtilityMethods::RecordEvent(ProfilingGuid entityGui
int threadId = armnnUtils::Threads::GetCurrentThreadId();
// Generate a GUID for the event
- ProfilingDynamicGuid eventGuid = ProfilingService::GetNextGuid();
+ ProfilingDynamicGuid eventGuid = IProfilingService::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::GetNextGuid();
+ ProfilingDynamicGuid executionLinkId = IProfilingService::GetNextGuid();
// Send the new execution link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
@@ -399,7 +399,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::RecordEvent(ProfilingGuid entityGui
ProfilingDynamicGuid TimelineUtilityMethods::RecordWorkloadInferenceAndStartOfLifeEvent(ProfilingGuid workloadGuid,
ProfilingGuid inferenceGuid)
{
- ProfilingDynamicGuid workloadInferenceGuid = ProfilingService::GetNextGuid();
+ ProfilingDynamicGuid workloadInferenceGuid = IProfilingService::GetNextGuid();
CreateTypedEntity(workloadInferenceGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID);
CreateRelationship(ProfilingRelationshipType::RetentionLink,
inferenceGuid,
diff --git a/src/profiling/TimelineUtilityMethods.hpp b/src/profiling/TimelineUtilityMethods.hpp
index d0c96587b4..fa25dc47b0 100644
--- a/src/profiling/TimelineUtilityMethods.hpp
+++ b/src/profiling/TimelineUtilityMethods.hpp
@@ -5,7 +5,7 @@
#pragma once
-#include "ProfilingService.hpp"
+#include "IProfilingService.hpp"
#include "armnn/profiling/ISendTimelinePacket.hpp"
#include <armnn/Types.hpp>
@@ -22,7 +22,7 @@ public:
// 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(ProfilingService& profilingService);
+ static std::unique_ptr<TimelineUtilityMethods> GetTimelineUtils(IProfilingService& profilingService);
TimelineUtilityMethods(
std::unique_ptr<ISendTimelinePacket>& sendTimelinePacket)
diff --git a/src/profiling/backends/BackendProfiling.hpp b/src/profiling/backends/BackendProfiling.hpp
index 82678a162f..545234db56 100644
--- a/src/profiling/backends/BackendProfiling.hpp
+++ b/src/profiling/backends/BackendProfiling.hpp
@@ -18,7 +18,7 @@ class BackendProfiling : public IBackendProfiling
{
public:
BackendProfiling(const ProfilingOptions& options,
- ProfilingService& profilingService,
+ IProfilingService& profilingService,
const armnn::BackendId& backendId)
: m_Options(options),
m_ProfilingService(profilingService),
@@ -44,7 +44,7 @@ public:
private:
ProfilingOptions m_Options;
- ProfilingService& m_ProfilingService;
+ IProfilingService& m_ProfilingService;
armnn::BackendId m_BackendId;
};
diff --git a/src/profiling/test/ProfilingTestUtils.hpp b/src/profiling/test/ProfilingTestUtils.hpp
index 810a34c3e2..16c6dde4ea 100644
--- a/src/profiling/test/ProfilingTestUtils.hpp
+++ b/src/profiling/test/ProfilingTestUtils.hpp
@@ -72,23 +72,22 @@ namespace pipe
class ProfilingServiceRuntimeHelper : public ProfilingService
{
public:
- ProfilingServiceRuntimeHelper(ProfilingService& profilingService)
+ ProfilingServiceRuntimeHelper(IProfilingService& profilingService)
: m_ProfilingService(profilingService) {}
~ProfilingServiceRuntimeHelper() = default;
BufferManager& GetProfilingBufferManager()
{
- return GetBufferManager(m_ProfilingService);
+ return GetBufferManager(static_cast<ProfilingService&>(m_ProfilingService));
}
- ProfilingService& m_ProfilingService;
+ IProfilingService& m_ProfilingService;
void ForceTransitionToState(ProfilingState newState)
{
- TransitionToState(m_ProfilingService, newState);
+ TransitionToState(static_cast<ProfilingService&>(m_ProfilingService), newState);
}
};
} // namespace pipe
} // namespace arm
-