aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/ProfilingService.cpp
diff options
context:
space:
mode:
authorDavid Monahan <david.monahan@arm.com>2020-02-12 15:52:35 +0000
committerDavid Monahan <david.monahan@arm.com>2020-02-13 14:58:57 +0000
commitc1536d69c1468514425e143b0578656f51598b94 (patch)
tree36f2add33c611be04f2c9840ea43bc302fdf6cfe /src/profiling/ProfilingService.cpp
parentabfa902188c3fcd72cf435a8a457807f3c7b6508 (diff)
downloadarmnn-c1536d69c1468514425e143b0578656f51598b94.tar.gz
IVGCVSW-4400 Backend Counter Registry Functionality
* Adding BackendProfilingContext to the MockBackend * Made IBackendProfilingContext pure Virtual * Added UnitTest using MockBackend for testing Backend Counter Registration * Moved Registry of backend counters from Initialize() to AddBackendProfilingContext() * Added m_MaxGlobalCounterId to ProfilingService * Removed automatic registration of MockBack in BackendRegistry() Signed-off-by: David Monahan <david.monahan@arm.com> Change-Id: Ie1c6c31e56d1ac7079d6116ecad041961014aedc
Diffstat (limited to 'src/profiling/ProfilingService.cpp')
-rw-r--r--src/profiling/ProfilingService.cpp17
1 files changed, 10 insertions, 7 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()