MCPcopy Create free account
hub / github.com/ARM-software/armnn / HandlePacket

Method HandlePacket

profiling/client/src/FileOnlyProfilingConnection.cpp:32–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 5

ProfilingExceptionClass · 0.85
GetHeaderMethod · 0.80
SetEndianessMethod · 0.80
ReturnPacketMethod · 0.80
GetDataMethod · 0.45

Tested by

no test coverage detected