ArmNN
 21.11
RequestCountersPacketHandler Class Reference

#include <RequestCountersPacketHandler.hpp>

Inheritance diagram for RequestCountersPacketHandler:
ILocalPacketHandler

Public Member Functions

 RequestCountersPacketHandler (uint32_t capturePeriod=LOWEST_CAPTURE_PERIOD)
 
std::vector< uint32_t > GetHeadersAccepted () override
 
void HandlePacket (const arm::pipe::Packet &packet) override
 process the packet More...
 
void SetConnection (IInternalProfilingConnection *profilingConnection) override
 Set a profiling connection on the handler. More...
 
- Public Member Functions inherited from ILocalPacketHandler
virtual ~ILocalPacketHandler ()
 

Detailed Description

Definition at line 20 of file RequestCountersPacketHandler.hpp.

Constructor & Destructor Documentation

◆ RequestCountersPacketHandler()

RequestCountersPacketHandler ( uint32_t  capturePeriod = LOWEST_CAPTURE_PERIOD)
inlineexplicit

Definition at line 23 of file RequestCountersPacketHandler.hpp.

References RequestCountersPacketHandler::GetHeadersAccepted(), and RequestCountersPacketHandler::HandlePacket().

23  :
24  m_CapturePeriod(capturePeriod),
25  m_Connection(nullptr),
26  m_CounterDirectoryMessageHeader(ConstructHeader(0, 2)) {}
uint32_t ConstructHeader(uint32_t packetFamily, uint32_t packetId)

Member Function Documentation

◆ GetHeadersAccepted()

std::vector< uint32_t > GetHeadersAccepted ( )
overridevirtual
Returns
lists the headers of the packets that this handler accepts only these packets will get sent to this handler. If this function returns an empty list then ALL packets will be sent to the PacketHandler i.e. a universal handler.

Implements ILocalPacketHandler.

Definition at line 21 of file RequestCountersPacketHandler.cpp.

Referenced by RequestCountersPacketHandler::RequestCountersPacketHandler().

22 {
23  std::vector<uint32_t> headers;
24  headers.push_back(m_CounterDirectoryMessageHeader); // counter directory
25  return headers;
26 }

◆ HandlePacket()

void HandlePacket ( const arm::pipe::Packet &  packet)
overridevirtual

process the packet

Implements ILocalPacketHandler.

Definition at line 28 of file RequestCountersPacketHandler.cpp.

References ICounterDirectory::GetCategories(), armnn::numeric_cast(), IInternalProfilingConnection::ReturnPacket(), armnn::profiling::uint16_t_size, armnn::profiling::uint32_t_size, armnn::profiling::WriteUint16(), and armnn::profiling::WriteUint32().

Referenced by RequestCountersPacketHandler::RequestCountersPacketHandler().

29 {
30  if (packet.GetHeader() != m_CounterDirectoryMessageHeader)
31  {
32  return;
33  }
34  arm::pipe::PacketVersionResolver packetVersionResolver;
35  DirectoryCaptureCommandHandler directoryCaptureCommandHandler(
36  0, 2, packetVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue());
37  directoryCaptureCommandHandler.operator()(packet);
38  const ICounterDirectory& counterDirectory = directoryCaptureCommandHandler.GetCounterDirectory();
39  for (auto& category : counterDirectory.GetCategories())
40  {
41  // Remember we need to translate the Uid's from our CounterDirectory instance to the parent one.
42  std::vector<uint16_t> translatedCounters;
43  for (auto const& copyUid : category->m_Counters)
44  {
45  translatedCounters.emplace_back(directoryCaptureCommandHandler.TranslateUIDCopyToOriginal(copyUid));
46  }
47  m_IdList.insert(std::end(m_IdList), std::begin(translatedCounters), std::end(translatedCounters));
48  }
49  SendCounterSelectionPacket();
50 }

◆ SetConnection()

void SetConnection ( IInternalProfilingConnection profilingConnection)
inlineoverridevirtual

Set a profiling connection on the handler.

Only need to implement this function if the handler will be writing data back to the profiled application.

Reimplemented from ILocalPacketHandler.

Definition at line 32 of file RequestCountersPacketHandler.hpp.

33  {
34  m_Connection = profilingConnection;
35  }

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