ArmNN
 21.02
ActivateTimelineReportingCommandHandler Class Reference

#include <ActivateTimelineReportingCommandHandler.hpp>

Inheritance diagram for ActivateTimelineReportingCommandHandler:

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 arm::pipe::Packet &packet) override
 

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  {}

Member Function Documentation

◆ operator()()

void operator() ( const arm::pipe::Packet &  packet)
override

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(fmt::format(
34  "Activate Timeline Reporting Command Handler invoked while in a wrong state: {}",
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  if(!m_TimelineReporting)
45  {
46  m_SendTimelinePacket.SendTimelineMessageDirectoryPackage();
47 
49 
50  m_TimelineReporting = true;
51 
52  m_ReportStructure.value().ReportStructure();
53 
54  m_BackendNotifier.NotifyBackendsForTimelineReporting();
55  }
56 
57  break;
58  default:
59  throw RuntimeException(fmt::format("Unknown profiling service state: {}",
60  static_cast<int>(currentState)));
61  }
62 }
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: