aboutsummaryrefslogtreecommitdiff
path: root/src/profiling
diff options
context:
space:
mode:
Diffstat (limited to 'src/profiling')
-rw-r--r--src/profiling/ProfilingService.cpp17
-rw-r--r--src/profiling/ProfilingService.hpp7
-rw-r--r--src/profiling/test/ProfilingTestUtils.cpp2
3 files changed, 15 insertions, 11 deletions
diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
index c73f3b29ec..27b05a60cf 100644
--- a/src/profiling/ProfilingService.cpp
+++ b/src/profiling/ProfilingService.cpp
@@ -181,6 +181,15 @@ void ProfilingService::Disconnect()
}
}
+// Store a profiling context returned from a backend that support profiling, and register its counters
+void ProfilingService::AddBackendProfilingContext(const BackendId backendId,
+ std::shared_ptr<armnn::profiling::IBackendProfilingContext> profilingContext)
+{
+ BOOST_ASSERT(profilingContext != nullptr);
+ // Register the backend counters
+ m_MaxGlobalCounterId = profilingContext->RegisterCounters(m_MaxGlobalCounterId);
+ m_BackendProfilingContexts.emplace(backendId, std::move(profilingContext));
+}
const ICounterDirectory& ProfilingService::GetCounterDirectory() const
{
return m_CounterDirectory;
@@ -369,13 +378,6 @@ void ProfilingService::Initialize()
BOOST_ASSERT(inferencesRunCounter);
InitializeCounterValue(inferencesRunCounter->m_Uid);
}
- // Register the backend counters
- uint16_t maxGlobalCounterId = armnn::profiling::INFERENCES_RUN;
- for (auto&& profilingContext : m_BackendProfilingContexts)
- {
- BOOST_ASSERT(profilingContext.second != nullptr);
- maxGlobalCounterId = profilingContext.second->RegisterCounters(maxGlobalCounterId);
- }
}
void ProfilingService::InitializeCounterValue(uint16_t counterUid)
@@ -409,6 +411,7 @@ void ProfilingService::Reset()
// ...finally reset the profiling state machine
m_StateMachine.Reset();
m_BackendProfilingContexts.clear();
+ m_MaxGlobalCounterId = armnn::profiling::INFERENCES_RUN;
}
void ProfilingService::Stop()
diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp
index 27166b362e..54c6540f7e 100644
--- a/src/profiling/ProfilingService.hpp
+++ b/src/profiling/ProfilingService.hpp
@@ -67,10 +67,7 @@ public:
// Store a profiling context returned from a backend that support profiling.
void AddBackendProfilingContext(const BackendId backendId,
- std::shared_ptr<armnn::profiling::IBackendProfilingContext> profilingContext)
- {
- m_BackendProfilingContexts.emplace(backendId, std::move(profilingContext));
- }
+ std::shared_ptr<armnn::profiling::IBackendProfilingContext> profilingContext);
const ICounterDirectory& GetCounterDirectory() const;
ICounterRegistry& GetCounterRegistry();
@@ -147,6 +144,7 @@ private:
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
@@ -196,6 +194,7 @@ protected:
m_PacketVersionResolver.ResolvePacketVersion(0, 5).GetEncodedValue(),
m_StateMachine)
, m_TimelinePacketWriterFactory(m_BufferManager)
+ , m_MaxGlobalCounterId(armnn::profiling::INFERENCES_RUN)
{
// Register the "Connection Acknowledged" command handler
m_CommandHandlerRegistry.RegisterFunctor(&m_ConnectionAcknowledgedCommandHandler);
diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp
index bc8b7a7b4d..dd54ca9ebc 100644
--- a/src/profiling/test/ProfilingTestUtils.cpp
+++ b/src/profiling/test/ProfilingTestUtils.cpp
@@ -359,6 +359,8 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
// 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));
// build up the structure of the network