8 #include <common/include/CommonProfilingUtils.hpp> 20 void PeriodicCounterCaptureCommandHandler::ParseData(
const arm::pipe::Packet& packet)
22 std::vector<uint16_t> counterIds;
23 std::vector<uint32_t> counterValues;
31 if (packet.GetLength() >= 8)
35 uint64_t timestamp = arm::pipe::ReadUint64(reinterpret_cast<const unsigned char*>(packet.GetData()), offset);
37 if (m_FirstTimestamp == 0)
39 m_FirstTimestamp = timestamp;
43 m_SecondTimestamp = timestamp;
45 m_FirstTimestamp = m_SecondTimestamp;
49 unsigned int counters = (packet.GetLength() - 8) / 6;
53 counterIds.reserve(counters);
54 counterValues.reserve(counters);
56 offset += sizeOfUint64;
57 for (
unsigned int pos = 0; pos < counters; ++pos)
59 counterIds.emplace_back(
60 arm::pipe::ReadUint16(reinterpret_cast<const unsigned char*>(packet.GetData()), offset));
61 offset += sizeOfUint16;
63 counterValues.emplace_back(
64 arm::pipe::ReadUint32(reinterpret_cast<const unsigned char*>(packet.GetData()), offset));
65 offset += sizeOfUint32;
78 if (!m_QuietOperation)
80 std::string header, body, uidString, valueString;
84 uidString.append(std::to_string(uid));
85 uidString.append(
", ");
90 valueString.append(std::to_string(val));
91 valueString.append(
", ");
98 body.append(arm::pipe::CentreAlignFormatting(uidString, 10));
100 body.append(arm::pipe::CentreAlignFormatting(valueString, 10));
103 if (!m_HeaderPrinted)
105 header.append(arm::pipe::CentreAlignFormatting(
" Timestamp", 11));
106 header.append(
" | ");
107 header.append(arm::pipe::CentreAlignFormatting(
"Period (us)", 13));
108 header.append(
" | ");
109 header.append(arm::pipe::CentreAlignFormatting(
"UID's", static_cast<int>(uidString.size())));
110 header.append(
" | ");
111 header.append(arm::pipe::CentreAlignFormatting(
"Values", 10));
115 m_HeaderPrinted =
true;
118 std::cout << std::string(body.size(),
'-') <<
"\n";
Copyright (c) 2021 ARM Limited and Contributors.
uint64_t m_CurrentPeriodValue
std::vector< uint32_t > m_Values
CounterCaptureValues m_CounterCaptureValues
std::vector< uint16_t > m_Uids
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
void operator()(const arm::pipe::Packet &packet) override