aboutsummaryrefslogtreecommitdiff
path: root/src/armnn
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnn')
-rw-r--r--src/armnn/BackendRegistry.cpp20
-rw-r--r--src/armnn/Runtime.cpp3
2 files changed, 23 insertions, 0 deletions
diff --git a/src/armnn/BackendRegistry.cpp b/src/armnn/BackendRegistry.cpp
index a79cdd0bb2..ff63c8236a 100644
--- a/src/armnn/BackendRegistry.cpp
+++ b/src/armnn/BackendRegistry.cpp
@@ -5,6 +5,7 @@
#include <armnn/BackendRegistry.hpp>
#include <armnn/Exceptions.hpp>
+#include <ProfilingService.hpp>
namespace armnn
{
@@ -24,11 +25,25 @@ void BackendRegistry::Register(const BackendId& id, BackendRegistry::FactoryFunc
CHECK_LOCATION());
}
m_Factories[id] = factory;
+
+ if (m_ProfilingService.has_value())
+ {
+ if (m_ProfilingService.has_value() && m_ProfilingService.value().IsProfilingEnabled())
+ {
+ m_ProfilingService.value().IncrementCounterValue(armnn::profiling::REGISTERED_BACKENDS);
+ }
+ }
+
}
void BackendRegistry::Deregister(const BackendId& id)
{
m_Factories.erase(id);
+
+ if (m_ProfilingService.has_value() && m_ProfilingService.value().IsProfilingEnabled())
+ {
+ m_ProfilingService.value().IncrementCounterValue(armnn::profiling::UNREGISTERED_BACKENDS);
+ }
}
bool BackendRegistry::IsBackendRegistered(const BackendId& id) const
@@ -86,5 +101,10 @@ void BackendRegistry::Swap(BackendRegistry& instance, BackendRegistry::FactorySt
std::swap(instance.m_Factories, other);
}
+void BackendRegistry::SetProfilingService(armnn::Optional<profiling::ProfilingService&> profilingService)
+{
+ m_ProfilingService = profilingService;
+}
+
} // namespace armnn
diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp
index 483eea7165..dbdd409784 100644
--- a/src/armnn/Runtime.cpp
+++ b/src/armnn/Runtime.cpp
@@ -220,6 +220,7 @@ Runtime::Runtime(const CreationOptions& options)
}
}
+ BackendRegistryInstance().SetProfilingService(m_ProfilingService);
// pass configuration info to the profiling service
m_ProfilingService.ConfigureProfilingService(options.m_ProfilingOptions);
@@ -269,6 +270,8 @@ Runtime::~Runtime()
DynamicBackendUtils::DeregisterDynamicBackends(m_DeviceSpec.GetDynamicBackends());
m_DeviceSpec.ClearDynamicBackends();
m_BackendContexts.clear();
+
+ BackendRegistryInstance().SetProfilingService(armnn::EmptyOptional());
}
LoadedNetwork* Runtime::GetLoadedNetworkPtr(NetworkId networkId) const