ArmNN
 20.11
RequestCounterDirectoryCommandHandler Class Reference

#include <RequestCounterDirectoryCommandHandler.hpp>

Inheritance diagram for RequestCounterDirectoryCommandHandler:

Public Member Functions

 RequestCounterDirectoryCommandHandler (uint32_t familyId, uint32_t packetId, uint32_t version, ICounterDirectory &counterDirectory, ISendCounterPacket &sendCounterPacket, ISendTimelinePacket &sendTimelinePacket, ProfilingStateMachine &profilingStateMachine)
 
void operator() (const arm::pipe::Packet &packet) override
 

Detailed Description

Definition at line 21 of file RequestCounterDirectoryCommandHandler.hpp.

Constructor & Destructor Documentation

◆ RequestCounterDirectoryCommandHandler()

RequestCounterDirectoryCommandHandler ( uint32_t  familyId,
uint32_t  packetId,
uint32_t  version,
ICounterDirectory counterDirectory,
ISendCounterPacket sendCounterPacket,
ISendTimelinePacket sendTimelinePacket,
ProfilingStateMachine profilingStateMachine 
)
inline

Definition at line 25 of file RequestCounterDirectoryCommandHandler.hpp.

References RequestCounterDirectoryCommandHandler::operator()().

32  : CommandHandlerFunctor(familyId, packetId, version)
33  , m_CounterDirectory(counterDirectory)
34  , m_SendCounterPacket(sendCounterPacket)
35  , m_SendTimelinePacket(sendTimelinePacket)
36  , m_StateMachine(profilingStateMachine)
37  {}

Member Function Documentation

◆ operator()()

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

Definition at line 16 of file RequestCounterDirectoryCommandHandler.cpp.

References armnn::profiling::Active, ProfilingStateMachine::GetCurrentState(), armnn::profiling::GetProfilingStateName(), armnn::profiling::NotConnected, ISendCounterPacket::SendCounterDirectoryPacket(), ISendTimelinePacket::SendTimelineMessageDirectoryPackage(), armnn::profiling::Uninitialised, and armnn::profiling::WaitingForAck.

Referenced by RequestCounterDirectoryCommandHandler::RequestCounterDirectoryCommandHandler().

17 {
18  ProfilingState currentState = m_StateMachine.GetCurrentState();
19  switch (currentState)
20  {
24  throw RuntimeException(fmt::format("Request Counter Directory Comand Handler invoked while in an "
25  "wrong state: {}",
26  GetProfilingStateName(currentState)));
28  // Process the packet
29  if (!(packet.GetPacketFamily() == 0u && packet.GetPacketId() == 3u))
30  {
31  throw armnn::InvalidArgumentException(fmt::format("Expected Packet family = 0, id = 3 but "
32  "received family = {}, id = {}",
33  packet.GetPacketFamily(),
34  packet.GetPacketId()));
35  }
36 
37  // Send all the packet required for the handshake with the external profiling service
38  m_SendCounterPacket.SendCounterDirectoryPacket(m_CounterDirectory);
39  m_SendTimelinePacket.SendTimelineMessageDirectoryPackage();
40 
41  break;
42  default:
43  throw RuntimeException(fmt::format("Unknown profiling service state: {}",
44  static_cast<int>(currentState)));
45  }
46 }
virtual void SendCounterDirectoryPacket(const ICounterDirectory &counterDirectory)=0
Create and write a CounterDirectoryPacket from the parameters to the buffer.
virtual void SendTimelineMessageDirectoryPackage()=0
Create and write a TimelineMessageDirectoryPackage in the buffer.
constexpr char const * GetProfilingStateName(ProfilingState state)

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