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

Method SendStreamMetaDataPacket

profiling/client/src/SendCounterPacket.cpp:26–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24{
25
26void SendCounterPacket::SendStreamMetaDataPacket()
27{
28 const std::string info(m_SoftwareInfo);
29 const std::string hardwareVersion(m_HardwareVersion);
30 const std::string softwareVersion(m_SoftwareVersion);
31 const std::string processName = GetProcessName().substr(0, 60);
32
33 const uint32_t infoSize = arm::pipe::numeric_cast<uint32_t>(info.size()) + 1;
34 const uint32_t hardwareVersionSize = arm::pipe::numeric_cast<uint32_t>(hardwareVersion.size()) + 1;
35 const uint32_t softwareVersionSize = arm::pipe::numeric_cast<uint32_t>(softwareVersion.size()) + 1;
36 const uint32_t processNameSize = arm::pipe::numeric_cast<uint32_t>(processName.size()) + 1;
37
38 const uint32_t sizeUint32 = sizeof(uint32_t);
39
40 const uint32_t headerSize = 2 * sizeUint32;
41 const uint32_t bodySize = 10 * sizeUint32;
42 const uint32_t packetVersionCountSize = sizeUint32;
43
44 // Supported Packets
45 // Packet Encoding version 1.0.0
46 // Control packet family
47 // Stream metadata packet (packet family=0; packet id=0)
48 // Connection Acknowledged packet ( packet family=0, packet id=1) Version 1.0.0
49 // Counter Directory packet (packet family=0; packet id=2) Version 1.0.0
50 // Request Counter Directory packet ( packet family=0, packet id=3) Version 1.0.0
51 // Periodic Counter Selection packet ( packet family=0, packet id=4) Version 1.0.0
52 // Per Job Counter Selection packet ( packet family=0, packet id=5) Version 1.0.0
53 // Activate Timeline Reporting (packet family = 0, packet id = 6) Version 1.0.0
54 // Deactivate Timeline Reporting (packet family = 0, packet id = 7) Version 1.0.0
55 // Counter Packet Family
56 // Periodic Counter Capture (packet_family = 3, packet_class = 0, packet_type = 0) Version 1.0.0
57 // Per-Job Counter Capture (packet_family = 3, packet_class = 1, packet_type = 0,1) Version 1.0.0
58 // Timeline Packet Family
59 // Timeline Message Directory (packet_family = 1, packet_class = 0, packet_type = 0) Version 1.0.0
60 // Timeline Message (packet_family = 1, packet_class = 0, packet_type = 1) Version 1.0.0
61 std::vector<std::pair<uint32_t, uint32_t>> packetVersions;
62 packetVersions.push_back(std::make_pair(ConstructHeader(0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
63 packetVersions.push_back(std::make_pair(ConstructHeader(0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
64 packetVersions.push_back(std::make_pair(ConstructHeader(0, 2), arm::pipe::EncodeVersion(1, 0, 0)));
65 packetVersions.push_back(std::make_pair(ConstructHeader(0, 3), arm::pipe::EncodeVersion(1, 0, 0)));
66 packetVersions.push_back(std::make_pair(ConstructHeader(0, 4), arm::pipe::EncodeVersion(1, 0, 0)));
67 packetVersions.push_back(std::make_pair(ConstructHeader(0, 5), arm::pipe::EncodeVersion(1, 0, 0)));
68 packetVersions.push_back(std::make_pair(ConstructHeader(0, 6), arm::pipe::EncodeVersion(1, 0, 0)));
69 packetVersions.push_back(std::make_pair(ConstructHeader(0, 7), arm::pipe::EncodeVersion(1, 0, 0)));
70 packetVersions.push_back(std::make_pair(ConstructHeader(3, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
71 packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 0), arm::pipe::EncodeVersion(1, 0, 0)));
72 packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 1), arm::pipe::EncodeVersion(1, 0, 0)));
73 packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
74 packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
75 uint32_t numberOfVersions = arm::pipe::numeric_cast<uint32_t>(packetVersions.size());
76 uint32_t packetVersionSize = arm::pipe::numeric_cast<uint32_t>(numberOfVersions * 2 * sizeUint32);
77
78 const uint32_t payloadSize = arm::pipe::numeric_cast<uint32_t>(infoSize + hardwareVersionSize +
79 softwareVersionSize + processNameSize +
80 packetVersionCountSize + packetVersionSize);
81
82 const uint32_t totalSize = headerSize + bodySize + payloadSize;
83 uint32_t offset = 0;

Callers 2

SendMethod · 0.45

Calls 13

GetProcessNameFunction · 0.85
ConstructHeaderFunction · 0.85
EncodeVersionFunction · 0.85
formatEnum · 0.85
GetCurrentProcessIdFunction · 0.85
push_backMethod · 0.80
emptyMethod · 0.80
WriteUint32Function · 0.70
sizeMethod · 0.45
ReserveMethod · 0.45
GetWritableDataMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected