{
if (m_Options.m_EnableProfiling == true)
{
- // Setup Counter Directory - this should only be created if profiling is enabled
- // Setup Counter meta
+ // Setup provisional Counter Directory example - this should only be created if profiling is enabled
+ // Setup provisional Counter meta example
+ const std::string categoryName = "Category";
+
+ m_CounterDirectory.RegisterCategory(categoryName);
+ m_CounterDirectory.RegisterDevice("device name", 0, categoryName);
+ m_CounterDirectory.RegisterCounterSet("counterSet_name", 2, categoryName);
+
+ m_CounterDirectory.RegisterCounter(categoryName,
+ 0,
+ 1,
+ 123.45f,
+ "counter name 1",
+ "counter description");
+
+ m_CounterDirectory.RegisterCounter(categoryName,
+ 0,
+ 1,
+ 123.45f,
+ "counter name 2",
+ "counter description");
// For now until CounterDirectory setup is implemented, change m_State once everything initialised
m_State.TransitionToState(ProfilingState::NotConnected);
}
}
+const ICounterDirectory& ProfilingService::GetCounterDirectory() const
+{
+ return m_CounterDirectory;
+}
+
ProfilingState ProfilingService::GetCurrentState() const
{
return m_State.GetCurrentState();
}
+
+void ProfilingService::ResetExternalProfilingOptions(const Runtime::CreationOptions::ExternalProfilingOptions& options)
+{
+ if(!m_Options.m_EnableProfiling)
+ {
+ m_Options = options;
+ Initialise();
+ return;
+ }
+ m_Options = options;
+}
} // namespace profiling
} // namespace armnn
\ No newline at end of file
#include "ProfilingStateMachine.hpp"
#include "ProfilingConnectionFactory.hpp"
+#include "CounterDirectory.hpp"
namespace armnn
{
void Run();
+ const ICounterDirectory& GetCounterDirectory() const;
ProfilingState GetCurrentState() const;
-
- // Options are public to allow profiling to be turned on at runtime
- Runtime::CreationOptions::ExternalProfilingOptions m_Options;
+ void ResetExternalProfilingOptions(const Runtime::CreationOptions::ExternalProfilingOptions& options);
private:
void Initialise();
- ProfilingStateMachine m_State;
+ CounterDirectory m_CounterDirectory;
ProfilingConnectionFactory m_Factory;
+ Runtime::CreationOptions::ExternalProfilingOptions m_Options;
+ ProfilingStateMachine m_State;
};
} // namespace profiling
BOOST_CHECK(service.GetCurrentState() == ProfilingState::Uninitialised);
service.Run();
BOOST_CHECK(service.GetCurrentState() == ProfilingState::Uninitialised);
- service.m_Options.m_EnableProfiling = true;
- service.Run();
+ options.m_EnableProfiling = true;
+ service.ResetExternalProfilingOptions(options);
BOOST_CHECK(service.GetCurrentState() == ProfilingState::NotConnected);
service.Run();
BOOST_CHECK(service.GetCurrentState() == ProfilingState::WaitingForAck);
}
+BOOST_AUTO_TEST_CASE(CheckProfilingServiceCounterDirectory)
+{
+ armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
+ ProfilingService service(options);
+
+ const ICounterDirectory& counterDirectory0 = service.GetCounterDirectory();
+ BOOST_CHECK(counterDirectory0.GetCounterCount() == 0);
+
+ options.m_EnableProfiling = true;
+ service.ResetExternalProfilingOptions(options);
+
+ const ICounterDirectory& counterDirectory1 = service.GetCounterDirectory();
+ BOOST_CHECK(counterDirectory1.GetCounterCount() != 0);
+}
+
BOOST_AUTO_TEST_CASE(CheckProfilingObjectUids)
{
uint16_t uid = 0;