22.02
|
#include <ProfilingService.hpp>
Public Types | |
using | ExternalProfilingOptions = IRuntime::CreationOptions::ExternalProfilingOptions |
using | IProfilingConnectionFactoryPtr = std::unique_ptr< IProfilingConnectionFactory > |
using | IProfilingConnectionPtr = std::unique_ptr< IProfilingConnection > |
using | CounterIndices = std::vector< std::atomic< uint32_t > * > |
using | CounterValues = std::list< std::atomic< uint32_t > > |
using | BackendProfilingContext = std::unordered_map< BackendId, std::shared_ptr< armnn::profiling::IBackendProfilingContext > > |
Public Member Functions | |
ProfilingService (Optional< IReportStructure &> reportStructure=EmptyOptional()) | |
~ProfilingService () | |
void | ResetExternalProfilingOptions (const ExternalProfilingOptions &options, bool resetProfilingService=false) |
ProfilingState | ConfigureProfilingService (const ExternalProfilingOptions &options, bool resetProfilingService=false) |
void | Update () |
void | Disconnect () |
void | AddBackendProfilingContext (const BackendId backendId, std::shared_ptr< armnn::profiling::IBackendProfilingContext > profilingContext) |
void | NotifyBackendsForTimelineReporting () override |
const ICounterDirectory & | GetCounterDirectory () const |
ICounterRegistry & | GetCounterRegistry () |
ProfilingState | GetCurrentState () const |
bool | IsCounterRegistered (uint16_t counterUid) const override |
uint32_t | GetAbsoluteCounterValue (uint16_t counterUid) const override |
uint32_t | GetDeltaCounterValue (uint16_t counterUid) override |
uint16_t | GetCounterCount () const override |
const ICounterMappings & | GetCounterMappings () const override |
IRegisterCounterMapping & | GetCounterMappingRegistry () |
bool | IsProfilingEnabled () const override |
CaptureData | GetCaptureData () override |
void | SetCaptureData (uint32_t capturePeriod, const std::vector< uint16_t > &counterIds, const std::set< BackendId > &activeBackends) |
void | SetCounterValue (uint16_t counterUid, uint32_t value) override |
uint32_t | AddCounterValue (uint16_t counterUid, uint32_t value) override |
uint32_t | SubtractCounterValue (uint16_t counterUid, uint32_t value) override |
uint32_t | IncrementCounterValue (uint16_t counterUid) override |
ProfilingDynamicGuid | NextGuid () override |
Return the next random Guid in the sequence. More... | |
ProfilingStaticGuid | GenerateStaticId (const std::string &str) override |
Create a ProfilingStaticGuid based on a hash of the string. More... | |
std::unique_ptr< ISendTimelinePacket > | GetSendTimelinePacket () const override |
ISendCounterPacket & | GetSendCounterPacket () override |
void | ResetGuidGenerator () |
bool | IsTimelineReportingEnabled () |
void | AddLocalPacketHandler (ILocalPacketHandlerSharedPtr localPacketHandler) |
void | NotifyProfilingServiceActive () override |
void | WaitForProfilingServiceActivation (unsigned int timeout) override |
Public Member Functions inherited from IReadWriteCounterValues | |
virtual | ~IReadWriteCounterValues () |
Public Member Functions inherited from IReadCounterValues | |
virtual | ~IReadCounterValues () |
Public Member Functions inherited from IWriteCounterValues | |
virtual | ~IWriteCounterValues () |
Public Member Functions inherited from IProfilingService | |
virtual | ~IProfilingService () |
Public Member Functions inherited from IProfilingServiceStatus | |
virtual | ~IProfilingServiceStatus () |
Public Member Functions inherited from INotifyBackends | |
virtual | ~INotifyBackends () |
Static Public Member Functions | |
static ProfilingDynamicGuid | GetNextGuid () |
static ProfilingStaticGuid | GetStaticId (const std::string &str) |
Protected Member Functions | |
void | SwapProfilingConnectionFactory (ProfilingService &instance, IProfilingConnectionFactory *other, IProfilingConnectionFactory *&backup) |
IProfilingConnection * | GetProfilingConnection (ProfilingService &instance) |
void | TransitionToState (ProfilingService &instance, ProfilingState newState) |
bool | WaitForPacketSent (ProfilingService &instance, uint32_t timeout=1000) |
BufferManager & | GetBufferManager (ProfilingService &instance) |
Definition at line 50 of file ProfilingService.hpp.
using BackendProfilingContext = std::unordered_map<BackendId, std::shared_ptr<armnn::profiling::IBackendProfilingContext> > |
Definition at line 59 of file ProfilingService.hpp.
using CounterIndices = std::vector<std::atomic<uint32_t>*> |
Definition at line 56 of file ProfilingService.hpp.
using CounterValues = std::list<std::atomic<uint32_t> > |
Definition at line 57 of file ProfilingService.hpp.
Definition at line 53 of file ProfilingService.hpp.
using IProfilingConnectionFactoryPtr = std::unique_ptr<IProfilingConnectionFactory> |
Definition at line 54 of file ProfilingService.hpp.
using IProfilingConnectionPtr = std::unique_ptr<IProfilingConnection> |
Definition at line 55 of file ProfilingService.hpp.
|
inline |
Definition at line 61 of file ProfilingService.hpp.
References ProfilingService::AddBackendProfilingContext(), ProfilingService::AddCounterValue(), ProfilingService::ConfigureProfilingService(), ProfilingService::Disconnect(), ProfilingService::GenerateStaticId(), ProfilingService::GetAbsoluteCounterValue(), ProfilingService::GetCaptureData(), ProfilingService::GetCounterCount(), ProfilingService::GetCounterDirectory(), ProfilingService::GetCounterMappingRegistry(), ProfilingService::GetCounterMappings(), ProfilingService::GetCounterRegistry(), ProfilingService::GetCurrentState(), ProfilingService::GetDeltaCounterValue(), ProfilingService::GetSendTimelinePacket(), ProfilingService::IncrementCounterValue(), ProfilingService::IsCounterRegistered(), ProfilingService::IsProfilingEnabled(), ProfilingService::NextGuid(), ProfilingService::NotifyBackendsForTimelineReporting(), ProfilingService::ResetExternalProfilingOptions(), ProfilingService::SetCaptureData(), ProfilingService::SetCounterValue(), ProfilingService::SubtractCounterValue(), ProfilingService::Update(), and ProfilingService::~ProfilingService().
Referenced by ProfilingService::IsTimelineReportingEnabled().
~ProfilingService | ( | ) |
Definition at line 540 of file ProfilingService.cpp.
Referenced by ProfilingService::ProfilingService().
void AddBackendProfilingContext | ( | const BackendId | backendId, |
std::shared_ptr< armnn::profiling::IBackendProfilingContext > | profilingContext | ||
) |
Definition at line 214 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by ProfilingService::ProfilingService(), and RuntimeImpl::RuntimeImpl().
|
overridevirtual |
Implements IWriteCounterValues.
Definition at line 295 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by ProfilingService::ProfilingService(), and TEST_SUITE().
void AddLocalPacketHandler | ( | ILocalPacketHandlerSharedPtr | localPacketHandler | ) |
Referenced by ProfilingService::IsTimelineReportingEnabled().
ProfilingState ConfigureProfilingService | ( | const ExternalProfilingOptions & | options, |
bool | resetProfilingService = false |
||
) |
Definition at line 62 of file ProfilingService.cpp.
References ProfilingStateMachine::GetCurrentState(), IRuntime::CreationOptions::ExternalProfilingOptions::m_EnableProfiling, armnn::profiling::NotConnected, ProfilingService::ResetExternalProfilingOptions(), armnn::profiling::Uninitialised, ProfilingService::Update(), and armnn::profiling::WaitingForAck.
Referenced by ProfilingService::ProfilingService(), RuntimeImpl::RuntimeImpl(), and TEST_SUITE().
void Disconnect | ( | ) |
Definition at line 193 of file ProfilingService.cpp.
References armnn::profiling::Active, ProfilingStateMachine::GetCurrentState(), armnn::profiling::NotConnected, armnn::profiling::Uninitialised, and armnn::profiling::WaitingForAck.
Referenced by ProfilingService::ProfilingService().
|
override |
Create a ProfilingStaticGuid based on a hash of the string.
Definition at line 324 of file ProfilingService.cpp.
References ProfilingService::GetStaticId().
Referenced by ProfilingService::ProfilingService().
|
overridevirtual |
Implements IReadCounterValues.
Definition at line 247 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by ProfilingService::ProfilingService(), and TEST_SUITE().
|
inlineprotected |
Definition at line 307 of file ProfilingService.hpp.
|
overridevirtual |
Implements IProfilingService.
Reimplemented in MockProfilingService.
Definition at line 275 of file ProfilingService.cpp.
References Holder::GetCaptureData().
Referenced by BackendProfiling::GetActiveCounters(), BackendProfiling::GetCounterStatus(), and ProfilingService::ProfilingService().
|
overridevirtual |
Implements IReadCounterValues.
Definition at line 237 of file ProfilingService.cpp.
References CounterDirectory::GetCounterCount().
Referenced by ProfilingService::ProfilingService().
const ICounterDirectory & GetCounterDirectory | ( | ) | const |
Definition at line 222 of file ProfilingService.cpp.
Referenced by ProfilingService::ProfilingService(), and TEST_SUITE().
IRegisterCounterMapping & GetCounterMappingRegistry | ( | ) |
Definition at line 270 of file ProfilingService.cpp.
Referenced by ProfilingService::ProfilingService(), and RegisterBackendCounters::RegisterCounter().
|
overridevirtual |
Implements IProfilingService.
Reimplemented in MockProfilingService.
Definition at line 265 of file ProfilingService.cpp.
Referenced by BackendProfiling::GetActiveCounters(), BackendProfiling::GetCounterStatus(), ProfilingService::ProfilingService(), BackendProfiling::ReportCounters(), and TEST_SUITE().
ICounterRegistry & GetCounterRegistry | ( | ) |
Definition at line 227 of file ProfilingService.cpp.
Referenced by ProfilingService::ProfilingService().
ProfilingState GetCurrentState | ( | ) | const |
Definition at line 232 of file ProfilingService.cpp.
References ProfilingStateMachine::GetCurrentState().
Referenced by TimelineUtilityMethods::GetTimelineUtils(), ProfilingService::ProfilingService(), and TEST_SUITE().
|
overridevirtual |
Implements IReadCounterValues.
Definition at line 255 of file ProfilingService.cpp.
References ARMNN_ASSERT, and ProfilingService::SubtractCounterValue().
Referenced by ProfilingService::ProfilingService(), and TEST_SUITE().
|
static |
Definition at line 26 of file ProfilingService.cpp.
Referenced by TimelineUtilityMethods::CreateConnectionRelationship(), TimelineUtilityMethods::CreateNamedTypedChildEntity(), TimelineUtilityMethods::CreateNamedTypedEntity(), TimelineUtilityMethods::CreateRelationship(), ProfilingService::GetSendCounterPacket(), TimelineUtilityMethods::MarkEntityWithLabel(), TimelineUtilityMethods::MarkEntityWithType(), ProfilingService::NextGuid(), TimelineUtilityMethods::RecordEvent(), TimelineUtilityMethods::RecordWorkloadInferenceAndStartOfLifeEvent(), and TEST_SUITE().
|
inlineprotected |
Definition at line 294 of file ProfilingService.hpp.
|
inlineoverridevirtual |
Implements IProfilingService.
Reimplemented in MockProfilingService.
Definition at line 204 of file ProfilingService.hpp.
References ProfilingService::GetNextGuid(), ProfilingService::GetStaticId(), and ProfilingService::ResetGuidGenerator().
Referenced by BackendProfiling::ReportCounters().
|
overridevirtual |
Implements IProfilingService.
Reimplemented in MockProfilingService.
Definition at line 329 of file ProfilingService.cpp.
References ARMNN_ASSERT, armnn::BackendRegistryInstance(), CounterDirectory::Clear(), TimelinePacketWriterFactory::GetSendTimelinePacket(), CounterDirectory::IsCategoryRegistered(), CounterDirectory::IsCounterRegistered(), ProfilingService::IsCounterRegistered(), Counter::m_Uid, armnn::profiling::NotConnected, CounterDirectory::RegisterCategory(), CounterDirectory::RegisterCounter(), BufferManager::Reset(), ProfilingStateMachine::Reset(), CounterIdMap::Reset(), ProfilingService::SetCounterValue(), SendThread::Stop(), CommandHandler::Stop(), PeriodicCounterCapture::Stop(), and ProfilingStateMachine::TransitionToState().
Referenced by BackendProfiling::GetSendTimelinePacket(), TimelineUtilityMethods::GetTimelineUtils(), ProfilingService::ProfilingService(), and TEST_SUITE().
|
static |
Definition at line 31 of file ProfilingService.cpp.
Referenced by TimelineUtilityMethods::DeclareLabel(), ProfilingService::GenerateStaticId(), ProfilingService::GetSendCounterPacket(), TEST_SUITE(), and VerifyTimelineLabelBinaryPacketData().
|
overridevirtual |
Implements IWriteCounterValues.
Definition at line 311 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by ProfilingService::ProfilingService(), and TEST_SUITE().
|
overridevirtual |
Implements IReadCounterValues.
Definition at line 242 of file ProfilingService.cpp.
References CounterDirectory::IsCounterRegistered().
Referenced by ProfilingService::GetSendTimelinePacket(), and ProfilingService::ProfilingService().
|
overridevirtual |
Implements IProfilingService.
Reimplemented in MockProfilingService.
Definition at line 57 of file ProfilingService.cpp.
References IRuntime::CreationOptions::ExternalProfilingOptions::m_EnableProfiling.
Referenced by BackendProfiling::IsProfilingEnabled(), and ProfilingService::ProfilingService().
|
inline |
Definition at line 215 of file ProfilingService.hpp.
References ProfilingService::AddLocalPacketHandler(), ProfilingService::NotifyProfilingServiceActive(), ProfilingService::ProfilingService(), and ProfilingService::WaitForProfilingServiceActivation().
Referenced by TimelineUtilityMethods::GetTimelineUtils().
|
override |
Return the next random Guid in the sequence.
Definition at line 319 of file ProfilingService.cpp.
References ProfilingService::GetNextGuid().
Referenced by ProfilingService::ProfilingService(), and TEST_SUITE().
|
overridevirtual |
Implements INotifyBackends.
Definition at line 495 of file ProfilingService.cpp.
Referenced by ProfilingService::ProfilingService().
|
overridevirtual |
Implements IProfilingServiceStatus.
Definition at line 507 of file ProfilingService.cpp.
Referenced by ProfilingService::IsTimelineReportingEnabled().
void ResetExternalProfilingOptions | ( | const ExternalProfilingOptions & | options, |
bool | resetProfilingService = false |
||
) |
Definition at line 41 of file ProfilingService.cpp.
References IRuntime::CreationOptions::ExternalProfilingOptions::m_TimelineEnabled, and ConnectionAcknowledgedCommandHandler::setTimelineEnabled().
Referenced by ProfilingService::ConfigureProfilingService(), ProfilingService::ProfilingService(), TEST_SUITE(), and VerifyPostOptimisationStructureTestImpl().
void ResetGuidGenerator | ( | ) |
Definition at line 36 of file ProfilingService.cpp.
Referenced by ProfilingService::GetSendCounterPacket(), and TEST_SUITE().
void SetCaptureData | ( | uint32_t | capturePeriod, |
const std::vector< uint16_t > & | counterIds, | ||
const std::set< BackendId > & | activeBackends | ||
) |
Definition at line 280 of file ProfilingService.cpp.
References Holder::SetCaptureData().
Referenced by ProfilingService::ProfilingService().
|
overridevirtual |
Implements IWriteCounterValues.
Definition at line 287 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by ProfilingService::GetSendTimelinePacket(), ProfilingService::ProfilingService(), and TEST_SUITE().
|
overridevirtual |
Implements IWriteCounterValues.
Definition at line 303 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by ProfilingService::GetDeltaCounterValue(), ProfilingService::ProfilingService(), and TEST_SUITE().
|
inlineprotected |
|
inlineprotected |
Definition at line 298 of file ProfilingService.hpp.
References ProfilingStateMachine::TransitionToState().
void Update | ( | ) |
Definition at line 112 of file ProfilingService.cpp.
References armnn::profiling::Active, ARMNN_ASSERT, ARMNN_LOG, ProfilingStateMachine::GetCurrentState(), IRuntime::CreationOptions::ExternalProfilingOptions::m_EnableProfiling, armnn::profiling::NotConnected, SendThread::Start(), CommandHandler::Start(), SendThread::Stop(), CommandHandler::Stop(), PeriodicCounterCapture::Stop(), ProfilingStateMachine::TransitionToState(), armnn::profiling::Uninitialised, armnn::profiling::WaitingForAck, armnn::warning, and Exception::what().
Referenced by ProfilingService::ConfigureProfilingService(), ProfilingService::ProfilingService(), and TEST_SUITE().
|
inlineprotected |
Definition at line 302 of file ProfilingService.hpp.
References SendThread::WaitForPacketSent().
Referenced by SwapProfilingConnectionFactoryHelper::WaitForPacketsSent().
|
overridevirtual |
Implements IProfilingServiceStatus.
Definition at line 516 of file ProfilingService.cpp.
References ARMNN_LOG, and armnn::warning.
Referenced by ProfilingService::IsTimelineReportingEnabled(), and RuntimeImpl::RuntimeImpl().