21.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 IProfilingGuidGenerator | |
virtual | ~IProfilingGuidGenerator () |
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 49 of file ProfilingService.hpp.
using BackendProfilingContext = std::unordered_map<BackendId, std::shared_ptr<armnn::profiling::IBackendProfilingContext> > |
Definition at line 58 of file ProfilingService.hpp.
using CounterIndices = std::vector<std::atomic<uint32_t>*> |
Definition at line 55 of file ProfilingService.hpp.
using CounterValues = std::list<std::atomic<uint32_t> > |
Definition at line 56 of file ProfilingService.hpp.
Definition at line 52 of file ProfilingService.hpp.
using IProfilingConnectionFactoryPtr = std::unique_ptr<IProfilingConnectionFactory> |
Definition at line 53 of file ProfilingService.hpp.
using IProfilingConnectionPtr = std::unique_ptr<IProfilingConnection> |
Definition at line 54 of file ProfilingService.hpp.
|
inline |
Definition at line 60 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 538 of file ProfilingService.cpp.
Referenced by ProfilingService::ProfilingService().
void AddBackendProfilingContext | ( | const BackendId | backendId, |
std::shared_ptr< armnn::profiling::IBackendProfilingContext > | profilingContext | ||
) |
Definition at line 212 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by ProfilingService::ProfilingService(), and RuntimeImpl::RuntimeImpl().
|
overridevirtual |
Implements IWriteCounterValues.
Definition at line 293 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::ProfilingService().
void AddLocalPacketHandler | ( | ILocalPacketHandlerSharedPtr | localPacketHandler | ) |
Referenced by ProfilingService::IsTimelineReportingEnabled().
ProfilingState ConfigureProfilingService | ( | const ExternalProfilingOptions & | options, |
bool | resetProfilingService = false |
||
) |
Definition at line 60 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 BOOST_AUTO_TEST_CASE(), ProfilingService::ProfilingService(), and RuntimeImpl::RuntimeImpl().
void Disconnect | ( | ) |
Definition at line 191 of file ProfilingService.cpp.
References armnn::profiling::Active, ProfilingStateMachine::GetCurrentState(), armnn::profiling::NotConnected, armnn::profiling::Uninitialised, and armnn::profiling::WaitingForAck.
Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::ProfilingService().
|
overridevirtual |
Create a ProfilingStaticGuid based on a hash of the string.
Implements IProfilingGuidGenerator.
Reimplemented in MockProfilingService.
Definition at line 322 of file ProfilingService.cpp.
References ProfilingService::GetStaticId().
Referenced by ProfilingService::ProfilingService().
|
overridevirtual |
Implements IReadCounterValues.
Definition at line 245 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::ProfilingService().
|
inlineprotected |
Definition at line 306 of file ProfilingService.hpp.
|
overridevirtual |
Implements IProfilingService.
Reimplemented in MockProfilingService.
Definition at line 273 of file ProfilingService.cpp.
References Holder::GetCaptureData().
Referenced by BackendProfiling::GetActiveCounters(), BackendProfiling::GetCounterStatus(), and ProfilingService::ProfilingService().
|
overridevirtual |
Implements IReadCounterValues.
Definition at line 235 of file ProfilingService.cpp.
References CounterDirectory::GetCounterCount().
Referenced by ProfilingService::ProfilingService().
const ICounterDirectory & GetCounterDirectory | ( | ) | const |
Definition at line 220 of file ProfilingService.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::ProfilingService().
IRegisterCounterMapping & GetCounterMappingRegistry | ( | ) |
Definition at line 268 of file ProfilingService.cpp.
Referenced by ProfilingService::ProfilingService(), and RegisterBackendCounters::RegisterCounter().
|
overridevirtual |
Implements IProfilingService.
Reimplemented in MockProfilingService.
Definition at line 263 of file ProfilingService.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), BackendProfiling::GetActiveCounters(), BackendProfiling::GetCounterStatus(), ProfilingService::ProfilingService(), and BackendProfiling::ReportCounters().
ICounterRegistry & GetCounterRegistry | ( | ) |
Definition at line 225 of file ProfilingService.cpp.
Referenced by ProfilingService::ProfilingService().
ProfilingState GetCurrentState | ( | ) | const |
Definition at line 230 of file ProfilingService.cpp.
References ProfilingStateMachine::GetCurrentState().
Referenced by BOOST_AUTO_TEST_CASE(), TimelineUtilityMethods::GetTimelineUtils(), and ProfilingService::ProfilingService().
|
overridevirtual |
Implements IReadCounterValues.
Definition at line 253 of file ProfilingService.cpp.
References ARMNN_ASSERT, and ProfilingService::SubtractCounterValue().
Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::ProfilingService().
|
static |
Definition at line 24 of file ProfilingService.cpp.
References ProfilingGuidGenerator::NextGuid().
Referenced by BOOST_AUTO_TEST_CASE(), TimelineUtilityMethods::CreateConnectionRelationship(), TimelineUtilityMethods::CreateNamedTypedChildEntity(), TimelineUtilityMethods::CreateNamedTypedEntity(), TimelineUtilityMethods::CreateRelationship(), ProfilingService::GetSendCounterPacket(), TimelineUtilityMethods::MarkEntityWithLabel(), TimelineUtilityMethods::MarkEntityWithType(), ProfilingService::NextGuid(), TimelineUtilityMethods::RecordEvent(), and TimelineUtilityMethods::RecordWorkloadInferenceAndStartOfLifeEvent().
|
inlineprotected |
Definition at line 293 of file ProfilingService.hpp.
|
inlineoverridevirtual |
Implements IProfilingService.
Reimplemented in MockProfilingService.
Definition at line 203 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 327 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 BOOST_AUTO_TEST_CASE(), BackendProfiling::GetSendTimelinePacket(), TimelineUtilityMethods::GetTimelineUtils(), and ProfilingService::ProfilingService().
|
static |
Definition at line 29 of file ProfilingService.cpp.
References ProfilingGuidGenerator::GenerateStaticId().
Referenced by BOOST_AUTO_TEST_CASE(), TimelineUtilityMethods::DeclareLabel(), ProfilingService::GenerateStaticId(), ProfilingService::GetSendCounterPacket(), and VerifyTimelineLabelBinaryPacketData().
|
overridevirtual |
Implements IWriteCounterValues.
Definition at line 309 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::ProfilingService().
|
overridevirtual |
Implements IReadCounterValues.
Definition at line 240 of file ProfilingService.cpp.
References CounterDirectory::IsCounterRegistered().
Referenced by ProfilingService::GetSendTimelinePacket(), and ProfilingService::ProfilingService().
|
overridevirtual |
Implements IProfilingService.
Reimplemented in MockProfilingService.
Definition at line 55 of file ProfilingService.cpp.
References IRuntime::CreationOptions::ExternalProfilingOptions::m_EnableProfiling.
Referenced by BackendProfiling::IsProfilingEnabled(), and ProfilingService::ProfilingService().
|
inline |
Definition at line 214 of file ProfilingService.hpp.
References ProfilingService::AddLocalPacketHandler(), ProfilingService::NotifyProfilingServiceActive(), ProfilingService::ProfilingService(), and ProfilingService::WaitForProfilingServiceActivation().
Referenced by TimelineUtilityMethods::GetTimelineUtils().
|
overridevirtual |
Return the next random Guid in the sequence.
Implements IProfilingGuidGenerator.
Reimplemented in MockProfilingService.
Definition at line 317 of file ProfilingService.cpp.
References ProfilingService::GetNextGuid().
Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::ProfilingService().
|
overridevirtual |
Implements INotifyBackends.
Definition at line 493 of file ProfilingService.cpp.
Referenced by ProfilingService::ProfilingService().
|
overridevirtual |
Implements IProfilingServiceStatus.
Definition at line 505 of file ProfilingService.cpp.
Referenced by ProfilingService::IsTimelineReportingEnabled().
void ResetExternalProfilingOptions | ( | const ExternalProfilingOptions & | options, |
bool | resetProfilingService = false |
||
) |
Definition at line 39 of file ProfilingService.cpp.
References IRuntime::CreationOptions::ExternalProfilingOptions::m_TimelineEnabled, and ConnectionAcknowledgedCommandHandler::setTimelineEnabled().
Referenced by BOOST_AUTO_TEST_CASE(), ProfilingService::ConfigureProfilingService(), ProfilingService::ProfilingService(), and VerifyPostOptimisationStructureTestImpl().
void ResetGuidGenerator | ( | ) |
Definition at line 34 of file ProfilingService.cpp.
References ProfilingGuidGenerator::Reset().
Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::GetSendCounterPacket().
void SetCaptureData | ( | uint32_t | capturePeriod, |
const std::vector< uint16_t > & | counterIds, | ||
const std::set< BackendId > & | activeBackends | ||
) |
Definition at line 278 of file ProfilingService.cpp.
References Holder::SetCaptureData().
Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::ProfilingService().
|
overridevirtual |
Implements IWriteCounterValues.
Definition at line 285 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by BOOST_AUTO_TEST_CASE(), ProfilingService::GetSendTimelinePacket(), and ProfilingService::ProfilingService().
|
overridevirtual |
Implements IWriteCounterValues.
Definition at line 301 of file ProfilingService.cpp.
References ARMNN_ASSERT.
Referenced by BOOST_AUTO_TEST_CASE(), ProfilingService::GetDeltaCounterValue(), and ProfilingService::ProfilingService().
|
inlineprotected |
|
inlineprotected |
Definition at line 297 of file ProfilingService.hpp.
References ProfilingStateMachine::TransitionToState().
void Update | ( | ) |
Definition at line 110 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 BOOST_AUTO_TEST_CASE(), ProfilingService::ConfigureProfilingService(), and ProfilingService::ProfilingService().
|
inlineprotected |
Definition at line 301 of file ProfilingService.hpp.
References SendThread::WaitForPacketSent().
Referenced by SwapProfilingConnectionFactoryHelper::WaitForPacketsSent().
|
overridevirtual |
Implements IProfilingServiceStatus.
Definition at line 514 of file ProfilingService.cpp.
References ARMNN_LOG, and armnn::warning.
Referenced by ProfilingService::IsTimelineReportingEnabled(), and RuntimeImpl::RuntimeImpl().