ArmNN
 20.05
ActivateTimelineReportingCommandHandler Class Reference

#include <ActivateTimelineReportingCommandHandler.hpp>

Inheritance diagram for ActivateTimelineReportingCommandHandler:
CommandHandlerFunctor

Public Member Functions

 ActivateTimelineReportingCommandHandler (uint32_t familyId, uint32_t packetId, uint32_t version, SendTimelinePacket &sendTimelinePacket, ProfilingStateMachine &profilingStateMachine, Optional< IReportStructure &> reportStructure, std::atomic< bool > &timelineReporting, INotifyBackends &notifyBackends)
 
void operator() (const Packet &packet) override
 
- Public Member Functions inherited from CommandHandlerFunctor
 CommandHandlerFunctor (uint32_t familyId, uint32_t packetId, uint32_t version)
 
uint32_t GetFamilyId () const
 
uint32_t GetPacketId () const
 
uint32_t GetVersion () const
 
virtual ~CommandHandlerFunctor ()
 

Detailed Description

Definition at line 25 of file ActivateTimelineReportingCommandHandler.hpp.

Constructor & Destructor Documentation

◆ ActivateTimelineReportingCommandHandler()

ActivateTimelineReportingCommandHandler ( uint32_t  familyId,
uint32_t  packetId,
uint32_t  version,
SendTimelinePacket sendTimelinePacket,
ProfilingStateMachine profilingStateMachine,
Optional< IReportStructure &>  reportStructure,
std::atomic< bool > &  timelineReporting,
INotifyBackends notifyBackends 
)
inline

Definition at line 28 of file ActivateTimelineReportingCommandHandler.hpp.

References ActivateTimelineReportingCommandHandler::operator()().

36  : CommandHandlerFunctor(familyId, packetId, version),
37  m_SendTimelinePacket(sendTimelinePacket),
38  m_StateMachine(profilingStateMachine),
39  m_TimelineReporting(timelineReporting),
40  m_BackendNotifier(notifyBackends),
41  m_ReportStructure(reportStructure)
42  {}
CommandHandlerFunctor(uint32_t familyId, uint32_t packetId, uint32_t version)

Member Function Documentation

◆ operator()()

void operator() ( const Packet &  packet)
overridevirtual

Implements CommandHandlerFunctor.

Definition at line 18 of file ActivateTimelineReportingCommandHandler.cpp.

References armnn::profiling::Active, ProfilingStateMachine::GetCurrentState(), armnn::profiling::GetProfilingStateName(), armnn::profiling::NotConnected, INotifyBackends::NotifyBackendsForTimelineReporting(), SendTimelinePacket::SendTimelineMessageDirectoryPackage(), TimelineUtilityMethods::SendWellKnownLabelsAndEventClasses(), armnn::profiling::Uninitialised, and armnn::profiling::WaitingForAck.

Referenced by ActivateTimelineReportingCommandHandler::ActivateTimelineReportingCommandHandler().

19 {
20  ProfilingState currentState = m_StateMachine.GetCurrentState();
21 
22  if (!m_ReportStructure.has_value())
23  {
24  throw armnn::Exception(std::string("Profiling Service constructor must be initialised with an "
25  "IReportStructure argument in order to run timeline reporting"));
26  }
27 
28  switch ( currentState )
29  {
33  throw RuntimeException(boost::str(
34  boost::format("Activate Timeline Reporting Command Handler invoked while in a wrong state: %1%")
35  % GetProfilingStateName(currentState)));
37  if ( !( packet.GetPacketFamily() == 0u && packet.GetPacketId() == 6u ))
38  {
39  throw armnn::Exception(std::string("Expected Packet family = 0, id = 6 but received family =")
40  + std::to_string(packet.GetPacketFamily())
41  + " id = " + std::to_string(packet.GetPacketId()));
42  }
43 
44  m_SendTimelinePacket.SendTimelineMessageDirectoryPackage();
45 
47 
48  m_TimelineReporting = true;
49 
50  m_ReportStructure.value().ReportStructure();
51 
52  m_BackendNotifier.NotifyBackendsForTimelineReporting();
53 
54  break;
55  default:
56  throw RuntimeException(boost::str(boost::format("Unknown profiling service state: %1%")
57  % static_cast<int>(currentState)));
58  }
59 }
virtual void NotifyBackendsForTimelineReporting()=0
void SendTimelineMessageDirectoryPackage() override
Create and write a TimelineMessageDirectoryPackage in the buffer.
Base class for all ArmNN exceptions so that users can filter to just those.
Definition: Exceptions.hpp:46
static void SendWellKnownLabelsAndEventClasses(ISendTimelinePacket &timelinePacket)
constexpr char const * GetProfilingStateName(ProfilingState state)

The documentation for this class was generated from the following files: