aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/ProfilingService.cpp
diff options
context:
space:
mode:
authorKeith Davis <keith.davis@arm.com>2019-12-02 15:12:19 +0000
committerKeith Davis <keith.davis@arm.com>2019-12-13 16:21:12 +0000
commite394bd99f1a55e099445823b7a951f0faa84d439 (patch)
treeced6e6d4a2932bda64c1f4c5e280b82d87b77929 /src/profiling/ProfilingService.cpp
parent60a20fb62c992c4c6369bb7f532957f3e151f3d8 (diff)
downloadarmnn-e394bd99f1a55e099445823b7a951f0faa84d439.tar.gz
IVGCVSW-4178 Add code to increment the 3 ArmNN counters
* Increment at Runtime.cpp | BackendRegistry.cpp | LoadedNetwork.cpp * Update unit tests * UID generation is now handled by backends Signed-off-by: Keith Davis <keith.davis@arm.com> Change-Id: Ifa53763409078c14839675206d8b260cdc36a8df
Diffstat (limited to 'src/profiling/ProfilingService.cpp')
-rw-r--r--src/profiling/ProfilingService.cpp70
1 files changed, 52 insertions, 18 deletions
diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
index 409e71dfa0..9119597ceb 100644
--- a/src/profiling/ProfilingService.cpp
+++ b/src/profiling/ProfilingService.cpp
@@ -5,6 +5,7 @@
#include "ProfilingService.hpp"
+#include <armnn/BackendId.hpp>
#include <armnn/Logging.hpp>
#include <boost/format.hpp>
@@ -29,6 +30,11 @@ void ProfilingService::ResetExternalProfilingOptions(const ExternalProfilingOpti
}
}
+bool ProfilingService::IsProfilingEnabled()
+{
+ return m_Options.m_EnableProfiling;
+}
+
ProfilingState ProfilingService::ConfigureProfilingService(
const ExternalProfilingOptions& options,
bool resetProfilingService)
@@ -235,14 +241,6 @@ uint32_t ProfilingService::IncrementCounterValue(uint16_t counterUid)
return counterValuePtr->operator++(std::memory_order::memory_order_relaxed);
}
-uint32_t ProfilingService::DecrementCounterValue(uint16_t counterUid)
-{
- CheckCounterUid(counterUid);
- std::atomic<uint32_t>* counterValuePtr = m_CounterIndex.at(counterUid);
- BOOST_ASSERT(counterValuePtr);
- return counterValuePtr->operator--(std::memory_order::memory_order_relaxed);
-}
-
ProfilingDynamicGuid ProfilingService::NextGuid()
{
return m_GuidGenerator.NextGuid();
@@ -266,41 +264,77 @@ void ProfilingService::Initialize()
m_CounterDirectory.RegisterCategory("ArmNN_Runtime");
}
- // Register a counter for the number of loaded networks
- if (!m_CounterDirectory.IsCounterRegistered("Loaded networks"))
+ // Register a counter for the number of Network loads
+ if (!m_CounterDirectory.IsCounterRegistered("Network loads"))
{
const Counter* loadedNetworksCounter =
- m_CounterDirectory.RegisterCounter("ArmNN_Runtime",
+ m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID,
+ armnn::profiling::NETWORK_LOADS,
+ "ArmNN_Runtime",
0,
0,
1.f,
- "Loaded networks",
+ "Network loads",
"The number of networks loaded at runtime",
std::string("networks"));
BOOST_ASSERT(loadedNetworksCounter);
InitializeCounterValue(loadedNetworksCounter->m_Uid);
}
-
+ // Register a counter for the number of unloaded networks
+ if (!m_CounterDirectory.IsCounterRegistered("Network unloads"))
+ {
+ const Counter* unloadedNetworksCounter =
+ m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID,
+ armnn::profiling::NETWORK_UNLOADS,
+ "ArmNN_Runtime",
+ 0,
+ 0,
+ 1.f,
+ "Network unloads",
+ "The number of networks unloaded at runtime",
+ std::string("networks"));
+ BOOST_ASSERT(unloadedNetworksCounter);
+ InitializeCounterValue(unloadedNetworksCounter->m_Uid);
+ }
// Register a counter for the number of registered backends
- if (!m_CounterDirectory.IsCounterRegistered("Registered backends"))
+ if (!m_CounterDirectory.IsCounterRegistered("Backends registered"))
{
const Counter* registeredBackendsCounter =
- m_CounterDirectory.RegisterCounter("ArmNN_Runtime",
+ m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID,
+ armnn::profiling::REGISTERED_BACKENDS,
+ "ArmNN_Runtime",
0,
0,
1.f,
- "Registered backends",
+ "Backends registered",
"The number of registered backends",
std::string("backends"));
BOOST_ASSERT(registeredBackendsCounter);
InitializeCounterValue(registeredBackendsCounter->m_Uid);
}
-
+ // Register a counter for the number of registered backends
+ if (!m_CounterDirectory.IsCounterRegistered("Backends unregistered"))
+ {
+ const Counter* unregisteredBackendsCounter =
+ m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID,
+ armnn::profiling::UNREGISTERED_BACKENDS,
+ "ArmNN_Runtime",
+ 0,
+ 0,
+ 1.f,
+ "Backends unregistered",
+ "The number of unregistered backends",
+ std::string("backends"));
+ BOOST_ASSERT(unregisteredBackendsCounter);
+ InitializeCounterValue(unregisteredBackendsCounter->m_Uid);
+ }
// Register a counter for the number of inferences run
if (!m_CounterDirectory.IsCounterRegistered("Inferences run"))
{
const Counter* inferencesRunCounter =
- m_CounterDirectory.RegisterCounter("ArmNN_Runtime",
+ m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID,
+ armnn::profiling::INFERENCES_RUN,
+ "ArmNN_Runtime",
0,
0,
1.f,