35 static const uint16_t NETWORK_LOADS = 0;
36 static const uint16_t NETWORK_UNLOADS = 1;
37 static const uint16_t REGISTERED_BACKENDS = 2;
38 static const uint16_t UNREGISTERED_BACKENDS = 3;
39 static const uint16_t INFERENCES_RUN = 4;
40 static const uint16_t MAX_ARMNN_COUNTER = INFERENCES_RUN;
61 bool resetProfilingService =
false);
72 std::shared_ptr<armnn::profiling::IBackendProfilingContext> profilingContext);
89 const std::vector<uint16_t>& counterIds,
90 const std::set<BackendId>& activeBackends);
108 return m_SendCounterPacket;
123 void InitializeCounterValue(uint16_t counterUid);
128 void CheckCounterUid(uint16_t counterUid)
const;
155 std::shared_ptr<armnn::profiling::IBackendProfilingContext>> m_BackendProfilingContexts;
156 uint16_t m_MaxGlobalCounterId;
162 , m_CounterDirectory()
164 , m_ProfilingConnection()
168 , m_CommandHandlerRegistry()
169 , m_PacketVersionResolver()
170 , m_CommandHandler(1000,
172 m_CommandHandlerRegistry,
173 m_PacketVersionResolver)
175 , m_SendCounterPacket(m_BufferManager)
176 , m_SendThread(m_StateMachine, m_BufferManager, m_SendCounterPacket)
177 , m_SendTimelinePacket(m_BufferManager)
178 , m_PeriodicCounterCapture(m_Holder, m_SendCounterPacket, *this, m_CounterIdMap, m_BackendProfilingContexts)
179 , m_ConnectionAcknowledgedCommandHandler(0,
181 m_PacketVersionResolver.ResolvePacketVersion(0, 1).GetEncodedValue(),
184 m_SendTimelinePacket,
186 , m_RequestCounterDirectoryCommandHandler(0,
188 m_PacketVersionResolver.ResolvePacketVersion(0, 3).GetEncodedValue(),
191 m_SendTimelinePacket,
193 , m_PeriodicCounterSelectionCommandHandler(0,
195 m_PacketVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue(),
196 m_BackendProfilingContexts,
200 m_PeriodicCounterCapture,
204 , m_PerJobCounterSelectionCommandHandler(0,
206 m_PacketVersionResolver.ResolvePacketVersion(0, 5).GetEncodedValue(),
208 , m_TimelinePacketWriterFactory(m_BufferManager)
209 , m_MaxGlobalCounterId(
armnn::profiling::INFERENCES_RUN)
212 m_CommandHandlerRegistry.
RegisterFunctor(&m_ConnectionAcknowledgedCommandHandler);
215 m_CommandHandlerRegistry.
RegisterFunctor(&m_RequestCounterDirectoryCommandHandler);
218 m_CommandHandlerRegistry.
RegisterFunctor(&m_PeriodicCounterSelectionCommandHandler);
221 m_CommandHandlerRegistry.
RegisterFunctor(&m_PerJobCounterSelectionCommandHandler);
230 BOOST_ASSERT(instance.m_ProfilingConnectionFactory);
233 backup = instance.m_ProfilingConnectionFactory.release();
234 instance.m_ProfilingConnectionFactory.reset(other);
238 return instance.m_ProfilingConnection.get();
251 return instance.m_BufferManager;
ICounterRegistry & GetCounterRegistry()
uint32_t GetCounterValue(uint16_t counterUid) const override
uint32_t SubtractCounterValue(uint16_t counterUid, uint32_t value) override
uint32_t AddCounterValue(uint16_t counterUid, uint32_t value) override
BufferManager & GetBufferManager(ProfilingService &instance)
bool WaitForPacketSent(uint32_t timeout)
const ICounterMappings & GetCounterMappings() const override
IRegisterCounterMapping & GetCounterMappingRegistry()
ProfilingStaticGuid GenerateStaticId(const std::string &str) override
Create a ProfilingStaticGuid based on a hash of the string.
IProfilingConnection * GetProfilingConnection(ProfilingService &instance)
void TransitionToState(ProfilingState newState)
void TransitionToState(ProfilingService &instance, ProfilingState newState)
ProfilingDynamicGuid NextGuid() override
Return the next random Guid in the sequence.
CaptureData GetCaptureData() override
std::list< std::atomic< uint32_t > > CounterValues
void SetCounterValue(uint16_t counterUid, uint32_t value) override
void AddBackendProfilingContext(const BackendId backendId, std::shared_ptr< armnn::profiling::IBackendProfilingContext > profilingContext)
const ICounterDirectory & GetCounterDirectory() const
bool IsCounterRegistered(uint16_t counterUid) const override
bool IsProfilingEnabled() const override
std::unique_ptr< IProfilingConnection > IProfilingConnectionPtr
bool IsEnabled()
Check if the profiling is enabled.
std::unique_ptr< IProfilingConnectionFactory > IProfilingConnectionFactoryPtr
void ResetExternalProfilingOptions(const ExternalProfilingOptions &options, bool resetProfilingService=false)
void RegisterFunctor(CommandHandlerFunctor *functor, uint32_t familyId, uint32_t packetId, uint32_t version)
std::vector< std::atomic< uint32_t > * > CounterIndices
uint32_t IncrementCounterValue(uint16_t counterUid) override
static ProfilingService & Instance()
bool WaitForPacketSent(ProfilingService &instance, uint32_t timeout=1000)
void SwapProfilingConnectionFactory(ProfilingService &instance, IProfilingConnectionFactory *other, IProfilingConnectionFactory *&backup)
Strongly typed guids to distinguish between those generated at runtime, and those that are statically...
uint16_t GetCounterCount() const override
ProfilingState GetCurrentState() const
std::unique_ptr< ISendTimelinePacket > GetSendTimelinePacket() const override
ProfilingState ConfigureProfilingService(const ExternalProfilingOptions &options, bool resetProfilingService=false)
armnn::Runtime::CreationOptions::ExternalProfilingOptions options
void SetCaptureData(uint32_t capturePeriod, const std::vector< uint16_t > &counterIds, const std::set< BackendId > &activeBackends)
ISendCounterPacket & GetSendCounterPacket() override