7 #include <common/include/EncodeVersion.hpp> 13 #include <common/include/Constants.hpp> 14 #include <common/include/SwTrace.hpp> 16 #include <boost/format.hpp> 17 #include <boost/numeric/conversion/cast.hpp> 36 const uint32_t infoSize =
numeric_cast<uint32_t>(info.size()) + 1;
37 const uint32_t hardwareVersionSize =
numeric_cast<uint32_t>(hardwareVersion.size()) + 1;
38 const uint32_t softwareVersionSize =
numeric_cast<uint32_t>(softwareVersion.size()) + 1;
39 const uint32_t processNameSize =
numeric_cast<uint32_t>(processName.size()) + 1;
41 const uint32_t sizeUint32 =
sizeof(uint32_t);
43 const uint32_t headerSize = 2 * sizeUint32;
44 const uint32_t bodySize = 10 * sizeUint32;
45 const uint32_t packetVersionCountSize = sizeUint32;
64 std::vector<std::pair<uint32_t, uint32_t>> packetVersions;
65 packetVersions.push_back(std::make_pair(
ConstructHeader(0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
66 packetVersions.push_back(std::make_pair(
ConstructHeader(0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
67 packetVersions.push_back(std::make_pair(
ConstructHeader(0, 2), arm::pipe::EncodeVersion(1, 0, 0)));
68 packetVersions.push_back(std::make_pair(
ConstructHeader(0, 3), arm::pipe::EncodeVersion(1, 0, 0)));
69 packetVersions.push_back(std::make_pair(
ConstructHeader(0, 4), arm::pipe::EncodeVersion(1, 0, 0)));
70 packetVersions.push_back(std::make_pair(
ConstructHeader(0, 5), arm::pipe::EncodeVersion(1, 0, 0)));
71 packetVersions.push_back(std::make_pair(
ConstructHeader(0, 6), arm::pipe::EncodeVersion(1, 0, 0)));
72 packetVersions.push_back(std::make_pair(
ConstructHeader(0, 7), arm::pipe::EncodeVersion(1, 0, 0)));
73 packetVersions.push_back(std::make_pair(
ConstructHeader(3, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
74 packetVersions.push_back(std::make_pair(
ConstructHeader(3, 1, 0), arm::pipe::EncodeVersion(1, 0, 0)));
75 packetVersions.push_back(std::make_pair(
ConstructHeader(3, 1, 1), arm::pipe::EncodeVersion(1, 0, 0)));
76 packetVersions.push_back(std::make_pair(
ConstructHeader(1, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
77 packetVersions.push_back(std::make_pair(
ConstructHeader(1, 0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
78 uint32_t numberOfVersions =
numeric_cast<uint32_t>(packetVersions.size());
79 uint32_t packetVersionSize =
numeric_cast<uint32_t>(numberOfVersions * 2 * sizeUint32);
81 const uint32_t payloadSize =
numeric_cast<uint32_t>(infoSize + hardwareVersionSize + softwareVersionSize +
82 processNameSize + packetVersionCountSize + packetVersionSize);
84 const uint32_t totalSize = headerSize + bodySize + payloadSize;
86 uint32_t reserved = 0;
90 if (writeBuffer ==
nullptr || reserved < totalSize)
92 CancelOperationAndThrow<BufferExhaustion>(
94 boost::str(boost::format(
"No space left in buffer. Unable to reserve (%1%) bytes.") % totalSize));
102 offset += sizeUint32;
103 WriteUint32(writeBuffer, offset, totalSize - headerSize);
107 offset += sizeUint32;
108 WriteUint32(writeBuffer, offset, arm::pipe::PIPE_MAGIC);
109 offset += sizeUint32;
110 WriteUint32(writeBuffer, offset, arm::pipe::EncodeVersion(1, 0, 0));
111 offset += sizeUint32;
113 offset += sizeUint32;
115 WriteUint32(writeBuffer, offset, numeric_cast<uint32_t>(pid));
116 offset += sizeUint32;
117 uint32_t poolOffset = bodySize;
119 offset += sizeUint32;
120 poolOffset += infoSize;
122 offset += sizeUint32;
123 poolOffset += hardwareVersionSize;
125 offset += sizeUint32;
126 poolOffset += softwareVersionSize;
128 offset += sizeUint32;
129 poolOffset += processNameSize;
131 offset += sizeUint32;
133 offset += sizeUint32;
139 memcpy(&writeBuffer->GetWritableData()[offset], info.c_str(), infoSize);
143 memcpy(&writeBuffer->GetWritableData()[offset], hardwareVersion.c_str(), hardwareVersionSize);
144 offset += hardwareVersionSize;
145 memcpy(&writeBuffer->GetWritableData()[offset], softwareVersion.c_str(), softwareVersionSize);
146 offset += softwareVersionSize;
147 memcpy(&writeBuffer->GetWritableData()[offset], processName.c_str(), processNameSize);
148 offset += processNameSize;
150 if (!packetVersions.empty())
153 WriteUint32(writeBuffer, offset, numberOfVersions << 16);
154 offset += sizeUint32;
157 for (std::pair<uint32_t, uint32_t>& packetVersion : packetVersions)
159 WriteUint32(writeBuffer, offset, packetVersion.first);
160 offset += sizeUint32;
161 WriteUint32(writeBuffer, offset, packetVersion.second);
162 offset += sizeUint32;
168 CancelOperationAndThrow<RuntimeException>(writeBuffer,
"Error processing packet.");
171 m_BufferManager.
Commit(writeBuffer, totalSize,
false);
177 std::string& errorMessage)
179 using namespace boost::numeric;
183 const std::string& categoryName = category->m_Name;
187 std::vector<uint16_t> categoryCounters;
188 for (
size_t counterIndex = 0; counterIndex < category->m_Counters.size(); ++counterIndex)
190 uint16_t counterUid = category->m_Counters.at(counterIndex);
191 auto it = counters.find(counterUid);
192 if (it == counters.end())
194 errorMessage = boost::str(boost::format(
"Counter (%1%) not found in category (%2%)")
195 % counterUid % category->m_Name );
201 if (counterUid == counter->m_MaxCounterUid)
203 categoryCounters.emplace_back(counterUid);
206 if (categoryCounters.empty())
208 errorMessage = boost::str(boost::format(
"No valid counters found in category (%1%)")% categoryName);
216 std::vector<uint32_t> categoryNameBuffer;
217 if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(categoryName, categoryNameBuffer))
219 errorMessage = boost::str(boost::format(
"Cannot convert the name of category (%1%) to an SWTrace namestring")
227 const uint32_t categoryRecordWord1 =
static_cast<uint32_t
>(categoryCounters.size()) << 16;
232 const uint32_t categoryRecordWord2 =
static_cast<uint32_t
>(3u *
uint32_t_size);
235 const size_t counterCount = categoryCounters.size();
236 std::vector<EventRecord> eventRecords(counterCount);
237 std::vector<uint32_t> eventRecordOffsets(counterCount, 0);
238 size_t eventRecordsSize = 0;
239 uint32_t eventRecordsOffset =
240 numeric_cast<uint32_t>((eventRecords.size() + categoryNameBuffer.size()) * uint32_t_size);
241 for (
size_t counterIndex = 0, eventRecordIndex = 0, eventRecordOffsetIndex = 0;
242 counterIndex < counterCount;
243 counterIndex++, eventRecordIndex++, eventRecordOffsetIndex++)
245 uint16_t counterUid = categoryCounters.at(counterIndex);
246 auto it = counters.find(counterUid);
249 EventRecord& eventRecord = eventRecords.at(eventRecordIndex);
256 eventRecordsSize += eventRecord.size();
259 eventRecordOffsets[eventRecordOffsetIndex] = eventRecordsOffset;
265 const uint32_t categoryRecordWord3 =
numeric_cast<uint32_t>((3u + eventRecordOffsets.size()) * uint32_t_size);
268 const size_t categoryRecordSize = 3u +
270 eventRecordOffsets.size() +
271 categoryNameBuffer.size() +
275 categoryRecord.resize(categoryRecordSize);
279 categoryRecord[0] = categoryRecordWord1;
280 categoryRecord[1] = categoryRecordWord2;
281 categoryRecord[2] = categoryRecordWord3;
282 auto offset = categoryRecord.begin() + 3u;
283 std::copy(eventRecordOffsets.begin(), eventRecordOffsets.end(), offset);
284 offset += eventRecordOffsets.size();
285 std::copy(categoryNameBuffer.begin(), categoryNameBuffer.end(), offset);
286 offset += categoryNameBuffer.size();
287 for (
const EventRecord& eventRecord : eventRecords)
289 std::copy(eventRecord.begin(), eventRecord.end(), offset);
290 offset += eventRecord.size();
299 std::string& errorMessage)
303 uint16_t deviceUid = device->m_Uid;
304 const std::string& deviceName = device->m_Name;
305 uint16_t deviceCores = device->m_Cores;
312 const uint32_t deviceRecordWord0 = (
static_cast<uint32_t
>(deviceUid) << 16) |
313 (
static_cast<uint32_t
>(deviceCores));
317 const uint32_t deviceRecordWord1 = 8u;
321 std::vector<uint32_t> deviceNameBuffer;
322 if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(deviceName, deviceNameBuffer))
324 errorMessage = boost::str(boost::format(
"Cannot convert the name of device %1% (%2%) to an SWTrace string")
331 const size_t deviceRecordSize = 2u +
332 deviceNameBuffer.size();
336 deviceRecord.resize(deviceRecordSize);
339 deviceRecord[0] = deviceRecordWord0;
340 deviceRecord[1] = deviceRecordWord1;
341 auto offset = deviceRecord.begin() + 2u;
342 std::copy(deviceNameBuffer.begin(), deviceNameBuffer.end(), offset);
349 std::string& errorMessage)
353 uint16_t counterSetUid = counterSet->m_Uid;
354 const std::string& counterSetName = counterSet->m_Name;
355 uint16_t counterSetCount = counterSet->m_Count;
362 const uint32_t counterSetRecordWord0 = (
static_cast<uint32_t
>(counterSetUid) << 16) |
363 (
static_cast<uint32_t
>(counterSetCount));
367 const uint32_t counterSetRecordWord1 = 8u;
371 std::vector<uint32_t> counterSetNameBuffer;
372 if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(counterSet->m_Name, counterSetNameBuffer))
374 errorMessage = boost::str(boost::format(
"Cannot convert the name of counter set %1% (%2%) to " 375 "an SWTrace namestring")
382 const size_t counterSetRecordSize = 2u +
383 counterSetNameBuffer.size();
387 counterSetRecord.resize(counterSetRecordSize);
390 counterSetRecord[0] = counterSetRecordWord0;
391 counterSetRecord[1] = counterSetRecordWord1;
392 auto offset = counterSetRecord.begin() + 2u;
393 std::copy(counterSetNameBuffer.begin(), counterSetNameBuffer.end(), offset);
400 std::string& errorMessage)
402 using namespace boost::numeric;
406 uint16_t counterUid = counter->m_Uid;
407 uint16_t maxCounterUid = counter->m_MaxCounterUid;
408 uint16_t deviceUid = counter->m_DeviceUid;
409 uint16_t counterSetUid = counter->m_CounterSetUid;
410 uint16_t counterClass = counter->m_Class;
411 uint16_t counterInterpolation = counter->m_Interpolation;
412 double counterMultiplier = counter->m_Multiplier;
413 const std::string& counterName = counter->m_Name;
414 const std::string& counterDescription = counter->m_Description;
415 const std::string& counterUnits = counter->m_Units;
418 ARMNN_ASSERT(counterInterpolation == 0 || counterInterpolation == 1);
428 const size_t eventRecordBlockSize = 8u;
437 const uint32_t eventRecordWord0 = (
static_cast<uint32_t
>(maxCounterUid) << 16) |
438 (
static_cast<uint32_t
>(counterUid));
445 const uint32_t eventRecordWord1 = (
static_cast<uint32_t
>(deviceUid) << 16) |
446 (
static_cast<uint32_t
>(counterSetUid));
451 const uint32_t eventRecordWord2 = (
static_cast<uint32_t
>(counterClass) << 16) |
452 (
static_cast<uint32_t
>(counterInterpolation));
457 uint32_t multiplier[2] = { 0u, 0u };
458 ARMNN_ASSERT(
sizeof(counterMultiplier) ==
sizeof(multiplier));
459 std::memcpy(multiplier, &counterMultiplier,
sizeof(multiplier));
460 const uint32_t eventRecordWord3 = multiplier[0];
461 const uint32_t eventRecordWord4 = multiplier[1];
465 const uint32_t eventRecordWord5 =
static_cast<uint32_t
>(eventRecordBlockSize *
uint32_t_size);
468 std::vector<uint32_t> counterNameBuffer;
469 if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(counterName, counterNameBuffer))
471 errorMessage = boost::str(boost::format(
"Cannot convert the name of counter %1% (name: %2%) " 472 "to an SWTrace string")
481 uint32_t eventRecordWord6 =
482 static_cast<uint32_t
>((counterNameBuffer.size() + eventRecordBlockSize) * uint32_t_size);
485 std::vector<uint32_t> counterDescriptionBuffer;
486 if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(counterDescription, counterDescriptionBuffer))
488 errorMessage = boost::str(boost::format(
"Cannot convert the description of counter %1% (description: %2%) " 489 "to an SWTrace string")
498 bool includeUnits = !counterUnits.empty();
500 const uint32_t eventRecordWord7 = includeUnits ?
507 std::vector<uint32_t> counterUnitsBuffer;
511 if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(counterUnits, counterUnitsBuffer))
513 errorMessage = boost::str(boost::format(
"Cannot convert the units of counter %1% (units: %2%) " 514 "to an SWTrace string")
522 const size_t eventRecordSize = eventRecordBlockSize +
523 counterNameBuffer.size() +
524 counterDescriptionBuffer.size() +
525 counterUnitsBuffer.size();
528 eventRecord.resize(eventRecordSize);
532 eventRecord[0] = eventRecordWord0;
533 eventRecord[1] = eventRecordWord1;
534 eventRecord[2] = eventRecordWord2;
535 eventRecord[3] = eventRecordWord3;
536 eventRecord[4] = eventRecordWord4;
537 eventRecord[5] = eventRecordWord5;
538 eventRecord[6] = eventRecordWord6;
539 eventRecord[7] = eventRecordWord7;
540 auto offset = eventRecord.begin() + 8u;
541 std::copy(counterNameBuffer.begin(), counterNameBuffer.end(), offset);
542 offset += counterNameBuffer.size();
543 std::copy(counterDescriptionBuffer.begin(), counterDescriptionBuffer.end(), offset);
546 offset += counterDescriptionBuffer.size();
547 std::copy(counterUnitsBuffer.begin(), counterUnitsBuffer.end(), offset);
556 using namespace boost::numeric;
565 const size_t packetHeaderSize = 2u;
566 const size_t bodyHeaderSize = 6u;
567 const uint32_t bodyHeaderSizeBytes = bodyHeaderSize *
uint32_t_size;
570 uint32_t pointerTableOffset = 0;
577 std::vector<DeviceRecord> deviceRecords(deviceCount);
579 std::vector<uint32_t> deviceRecordOffsets(deviceCount, 0);
580 size_t deviceRecordsSize = 0;
581 size_t deviceIndex = 0;
582 size_t deviceRecordOffsetIndex = 0;
584 pointerTableOffset =
numeric_cast<uint32_t>(deviceCount * uint32_t_size +
585 counterSetCount * uint32_t_size +
587 for (
auto it = devices.begin(); it != devices.end(); it++)
590 DeviceRecord& deviceRecord = deviceRecords.at(deviceIndex);
592 std::string errorMessage;
595 CancelOperationAndThrow<RuntimeException>(errorMessage);
599 deviceRecordsSize += deviceRecord.size();
602 deviceRecordOffsets[deviceRecordOffsetIndex] = pointerTableOffset;
606 deviceRecordOffsetIndex++;
614 std::vector<CounterSetRecord> counterSetRecords(counterSetCount);
616 std::vector<uint32_t> counterSetRecordOffsets(counterSetCount, 0);
617 size_t counterSetRecordsSize = 0;
618 size_t counterSetIndex = 0;
619 size_t counterSetRecordOffsetIndex = 0;
622 for (
auto it = counterSets.begin(); it != counterSets.end(); it++)
627 std::string errorMessage;
630 CancelOperationAndThrow<RuntimeException>(errorMessage);
634 counterSetRecordsSize += counterSetRecord.size();
637 counterSetRecordOffsets[counterSetRecordOffsetIndex] = pointerTableOffset;
641 counterSetRecordOffsetIndex++;
649 std::vector<CategoryRecord> categoryRecords(categoryCount);
651 std::vector<uint32_t> categoryRecordOffsets(categoryCount, 0);
652 size_t categoryRecordsSize = 0;
653 size_t categoryIndex = 0;
654 size_t categoryRecordOffsetIndex = 0;
657 for (
auto it = categories.begin(); it != categories.end(); it++)
660 CategoryRecord& categoryRecord = categoryRecords.at(categoryIndex);
662 std::string errorMessage;
665 CancelOperationAndThrow<RuntimeException>(errorMessage);
669 categoryRecordsSize += categoryRecord.size();
672 categoryRecordOffsets[categoryRecordOffsetIndex] = pointerTableOffset;
676 categoryRecordOffsetIndex++;
680 const size_t counterDirectoryPacketDataLength =
682 deviceRecordOffsets.size() +
683 counterSetRecordOffsets.size() +
684 categoryRecordOffsets.size() +
686 counterSetRecordsSize +
690 const size_t counterDirectoryPacketSize = packetHeaderSize +
691 counterDirectoryPacketDataLength;
694 std::vector<uint32_t> counterDirectoryPacket(counterDirectoryPacketSize, 0);
705 uint32_t packetFamily = 0;
706 uint32_t packetId = 2;
707 uint32_t packetHeaderWord0 = ((packetFamily & 0x3F) << 26) | ((packetId & 0x3FF) << 16);
714 uint32_t packetHeader[2]
727 const uint32_t bodyHeaderWord0 =
static_cast<uint32_t
>(deviceCount) << 16;
731 const uint32_t bodyHeaderWord1 = bodyHeaderSizeBytes;
738 const uint32_t bodyHeaderWord2 =
static_cast<uint32_t
>(counterSetCount) << 16;
742 const uint32_t bodyHeaderWord3 =
743 numeric_cast<uint32_t>(deviceRecordOffsets.size() * uint32_t_size
744 + bodyHeaderSizeBytes);
749 const uint32_t bodyHeaderWord4 =
static_cast<uint32_t
>(categoryCount) << 16;
753 const uint32_t bodyHeaderWord5 =
755 deviceRecordOffsets.size() * uint32_t_size +
756 counterSetRecordOffsets.size() * uint32_t_size
757 + bodyHeaderSizeBytes);
760 const uint32_t bodyHeader[bodyHeaderSize]
772 auto counterDirectoryPacketOffset = counterDirectoryPacket.begin();
774 std::copy(packetHeader, packetHeader + packetHeaderSize, counterDirectoryPacketOffset);
775 counterDirectoryPacketOffset += packetHeaderSize;
777 std::copy(bodyHeader, bodyHeader + bodyHeaderSize, counterDirectoryPacketOffset);
778 counterDirectoryPacketOffset += bodyHeaderSize;
780 std::copy(deviceRecordOffsets.begin(), deviceRecordOffsets.end(), counterDirectoryPacketOffset);
781 counterDirectoryPacketOffset += deviceRecordOffsets.size();
783 std::copy(counterSetRecordOffsets.begin(), counterSetRecordOffsets.end(), counterDirectoryPacketOffset);
784 counterDirectoryPacketOffset += counterSetRecordOffsets.size();
786 std::copy(categoryRecordOffsets.begin(), categoryRecordOffsets.end(), counterDirectoryPacketOffset);
787 counterDirectoryPacketOffset += categoryRecordOffsets.size();
791 std::copy(deviceRecord.begin(), deviceRecord.end(), counterDirectoryPacketOffset);
792 counterDirectoryPacketOffset += deviceRecord.size();
797 std::copy(counterSetRecord.begin(), counterSetRecord.end(), counterDirectoryPacketOffset);
798 counterDirectoryPacketOffset += counterSetRecord.size();
803 std::copy(categoryRecord.begin(), categoryRecord.end(), counterDirectoryPacketOffset);
804 counterDirectoryPacketOffset += categoryRecord.size();
812 uint32_t reserved = 0;
813 IPacketBufferPtr writeBuffer = m_BufferManager.Reserve(totalSize, reserved);
815 if (writeBuffer ==
nullptr || reserved < totalSize)
817 CancelOperationAndThrow<BufferExhaustion>(
819 boost::str(boost::format(
"No space left in buffer. Unable to reserve (%1%) bytes.") % totalSize));
826 for (uint32_t counterDirectoryPacketWord : counterDirectoryPacket)
828 WriteUint32(writeBuffer, offset, counterDirectoryPacketWord);
832 m_BufferManager.Commit(writeBuffer, totalSize);
839 uint32_t uint64_t_size =
sizeof(uint64_t);
841 uint32_t packetFamily = 3;
842 uint32_t packetClass = 0;
843 uint32_t packetType = 0;
845 uint32_t bodySize = uint64_t_size +
numeric_cast<uint32_t>(values.size()) * (uint16_t_size + uint32_t_size);
846 uint32_t totalSize = headerSize + bodySize;
848 uint32_t reserved = 0;
850 IPacketBufferPtr writeBuffer = m_BufferManager.Reserve(totalSize, reserved);
852 if (writeBuffer ==
nullptr || reserved < totalSize)
854 CancelOperationAndThrow<BufferExhaustion>(
856 boost::str(boost::format(
"No space left in buffer. Unable to reserve (%1%) bytes.") % totalSize));
862 ((packetFamily & 0x0000003F) << 26) |
863 ((packetClass & 0x0000007F) << 19) |
864 ((packetType & 0x00000007) << 16));
873 offset += uint64_t_size;
874 for (
const auto& pair: values)
878 WriteUint32(writeBuffer, offset, pair.counterValue);
882 m_BufferManager.Commit(writeBuffer, totalSize);
886 const std::vector<uint16_t>& selectedCounterIds)
891 uint32_t packetFamily = 0;
892 uint32_t packetId = 4;
894 uint32_t bodySize = uint32_t_size +
numeric_cast<uint32_t>(selectedCounterIds.size()) * uint16_t_size;
895 uint32_t totalSize = headerSize + bodySize;
897 uint32_t reserved = 0;
899 IPacketBufferPtr writeBuffer = m_BufferManager.Reserve(totalSize, reserved);
901 if (writeBuffer ==
nullptr || reserved < totalSize)
903 CancelOperationAndThrow<BufferExhaustion>(
905 boost::str(boost::format(
"No space left in buffer. Unable to reserve (%1%) bytes.") % totalSize));
909 WriteUint32(writeBuffer, offset, ((packetFamily & 0x3F) << 26) | ((packetId & 0x3FF) << 16));
919 for(
const uint16_t&
id: selectedCounterIds)
925 m_BufferManager.Commit(writeBuffer, totalSize);
virtual IPacketBufferPtr Reserve(unsigned int requestedSize, unsigned int &reservedSize)=0
std::vector< uint32_t > CounterSetRecord
std::vector< CounterValue > IndexValuePairsVector
std::vector< uint32_t > DeviceRecord
std::string GetHardwareVersion()
void WriteUint16(const IPacketBufferPtr &packetBuffer, unsigned int offset, uint16_t value)
void WriteUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset, uint32_t value)
bool CreateDeviceRecord(const DevicePtr &device, DeviceRecord &deviceRecord, std::string &errorMessage)
void SendCounterDirectoryPacket(const ICounterDirectory &counterDirectory) override
Create and write a CounterDirectoryPacket from the parameters to the buffer.
std::unordered_map< uint16_t, CounterPtr > Counters
#define ARMNN_NO_CONVERSION_WARN_END
std::unique_ptr< Device > DevicePtr
std::string GetProcessName()
void SendStreamMetaDataPacket() override
Create and write a StreamMetaDataPacket in the buffer.
std::unique_ptr< CounterSet > CounterSetPtr
virtual void Commit(IPacketBufferPtr &packetBuffer, unsigned int size, bool notifyConsumer=true)=0
Copyright (c) 2020 ARM Limited.
virtual const CounterSets & GetCounterSets() const =0
std::string GetSoftwareInfo()
virtual uint16_t GetCategoryCount() const =0
std::unordered_map< uint16_t, CounterSetPtr > CounterSets
virtual const Categories & GetCategories() const =0
std::vector< uint32_t > EventRecord
virtual const Devices & GetDevices() const =0
std::shared_ptr< Counter > CounterPtr
void SendPeriodicCounterCapturePacket(uint64_t timestamp, const IndexValuePairsVector &values) override
Create and write a PeriodicCounterCapturePacket from the parameters to the buffer.
bool CreateCounterSetRecord(const CounterSetPtr &counterSet, CounterSetRecord &counterSetRecord, std::string &errorMessage)
virtual uint16_t GetDeviceCount() const =0
uint32_t ConstructHeader(uint32_t packetFamily, uint32_t packetId)
#define ARMNN_ASSERT(COND)
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
#define MAX_METADATA_PACKET_LENGTH
void WriteUint64(const std::unique_ptr< IPacketBuffer > &packetBuffer, unsigned int offset, uint64_t value)
std::unordered_set< CategoryPtr > Categories
virtual uint16_t GetCounterSetCount() const =0
#define ARMNN_NO_CONVERSION_WARN_BEGIN
std::string GetSoftwareVersion()
void SendPeriodicCounterSelectionPacket(uint32_t capturePeriod, const std::vector< uint16_t > &selectedCounterIds) override
Create and write a PeriodicCounterSelectionPacket from the parameters to the buffer.
std::vector< uint32_t > CategoryRecord
std::unique_ptr< Category > CategoryPtr
virtual const Counters & GetCounters() const =0
std::unordered_map< uint16_t, DevicePtr > Devices
bool CreateEventRecord(const CounterPtr &counter, EventRecord &eventRecord, std::string &errorMessage)
std::unique_ptr< IPacketBuffer > IPacketBufferPtr
bool CreateCategoryRecord(const CategoryPtr &category, const Counters &counters, CategoryRecord &categoryRecord, std::string &errorMessage)