ArmNN
 21.11
StreamMetaDataProcessor Class Reference

#include <FileOnlyProfilingConnection.hpp>

Inheritance diagram for StreamMetaDataProcessor:
ILocalPacketHandler

Public Member Functions

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

Detailed Description

Definition at line 32 of file FileOnlyProfilingConnection.hpp.

Constructor & Destructor Documentation

◆ StreamMetaDataProcessor()

StreamMetaDataProcessor ( FileOnlyProfilingConnection fileOnlyProfilingConnection)
inlineexplicit

Definition at line 35 of file FileOnlyProfilingConnection.hpp.

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

35  :
36  m_FileOnlyProfilingConnection(fileOnlyProfilingConnection),
37  m_MetaDataPacketHeader(ConstructHeader(0, 0)) {};
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 23 of file FileOnlyProfilingConnection.cpp.

Referenced by StreamMetaDataProcessor::StreamMetaDataProcessor().

24 {
25  std::vector<uint32_t> headers;
26  headers.push_back(m_MetaDataPacketHeader);
27  return headers;
28 }

◆ HandlePacket()

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

process the packet

Implements ILocalPacketHandler.

Definition at line 30 of file FileOnlyProfilingConnection.cpp.

References armnn::profiling::BeWire, armnn::profiling::LeWire, FileOnlyProfilingConnection::ReturnPacket(), and FileOnlyProfilingConnection::SetEndianess().

Referenced by StreamMetaDataProcessor::StreamMetaDataProcessor().

31 {
32  if (packet.GetHeader() != m_MetaDataPacketHeader)
33  {
34  throw arm::pipe::ProfilingException("StreamMetaDataProcessor can only handle Stream Meta Data Packets");
35  }
36  // determine the endianness of the protocol
37  TargetEndianness endianness;
38  if (ToUint32(packet.GetData(),TargetEndianness::BeWire) == arm::pipe::PIPE_MAGIC)
39  {
40  endianness = TargetEndianness::BeWire;
41  }
42  else if (ToUint32(packet.GetData(), TargetEndianness::LeWire) == arm::pipe::PIPE_MAGIC)
43  {
44  endianness = TargetEndianness::LeWire;
45  }
46  else
47  {
48  throw arm::pipe::ProfilingException("Protocol read error. Unable to read the PIPE_MAGIC value.");
49  }
50  m_FileOnlyProfilingConnection->SetEndianess(endianness);
51  // send back the acknowledgement
52  std::unique_ptr<unsigned char[]> uniqueNullPtr = nullptr;
53  arm::pipe::Packet returnPacket(0x10000, 0, uniqueNullPtr);
54  m_FileOnlyProfilingConnection->ReturnPacket(returnPacket);
55 }
void SetEndianess(const TargetEndianness &endianness) override
void ReturnPacket(arm::pipe::Packet &packet) override

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