ArmNN
 20.02
PeriodicCounterCaptureCommandHandler Class Reference

#include <PeriodicCounterCaptureCommandHandler.hpp>

Inheritance diagram for PeriodicCounterCaptureCommandHandler:
CommandHandlerFunctor

Public Member Functions

 PeriodicCounterCaptureCommandHandler (uint32_t familyId, uint32_t packetId, uint32_t version, bool quietOperation=false)
 
void operator() (const armnn::profiling::Packet &packet) override
 
- Public Member Functions inherited from CommandHandlerFunctor
 CommandHandlerFunctor (uint32_t familyId, uint32_t packetId, uint32_t version)
 
uint32_t GetFamilyId () const
 
uint32_t GetPacketId () const
 
uint32_t GetVersion () const
 
virtual ~CommandHandlerFunctor ()
 

Public Attributes

CounterCaptureValues m_CounterCaptureValues
 
uint64_t m_CurrentPeriodValue = 0
 

Detailed Description

Definition at line 26 of file PeriodicCounterCaptureCommandHandler.hpp.

Constructor & Destructor Documentation

◆ PeriodicCounterCaptureCommandHandler()

PeriodicCounterCaptureCommandHandler ( uint32_t  familyId,
uint32_t  packetId,
uint32_t  version,
bool  quietOperation = false 
)
inline
Parameters
familyIdThe family of the packets this handler will service
packetIdThe id of packets this handler will process.
versionThe version of that id.
quietOperationOptional parameter to turn off printouts. This is useful for unittests.

Definition at line 36 of file PeriodicCounterCaptureCommandHandler.hpp.

40  : CommandHandlerFunctor(familyId, packetId, version)
41  , m_QuietOperation(quietOperation)
42  {}
CommandHandlerFunctor(uint32_t familyId, uint32_t packetId, uint32_t version)

Member Function Documentation

◆ operator()()

void operator() ( const armnn::profiling::Packet packet)
overridevirtual

Implements CommandHandlerFunctor.

Definition at line 77 of file PeriodicCounterCaptureCommandHandler.cpp.

References armnn::profiling::CentreAlignFormatting(), PeriodicCounterCaptureCommandHandler::m_CounterCaptureValues, PeriodicCounterCaptureCommandHandler::m_CurrentPeriodValue, CounterCaptureValues::m_Timestamp, CounterCaptureValues::m_Uids, and CounterCaptureValues::m_Values.

78 {
79  ParseData(packet);
80  if (!m_QuietOperation) // Are we supposed to print to stdout?
81  {
82  std::string header, body, uidString, valueString;
83 
84  for (uint16_t uid : m_CounterCaptureValues.m_Uids)
85  {
86  uidString.append(std::to_string(uid));
87  uidString.append(", ");
88  }
89 
90  for (uint32_t val : m_CounterCaptureValues.m_Values)
91  {
92  valueString.append(std::to_string(val));
93  valueString.append(", ");
94  }
95 
97  body.append(" | ");
98  body.append(profiling::CentreAlignFormatting(std::to_string(m_CurrentPeriodValue), 13));
99  body.append(" | ");
100  body.append(profiling::CentreAlignFormatting(uidString, 10));
101  body.append(" | ");
102  body.append(profiling::CentreAlignFormatting(valueString, 10));
103  body.append("\n");
104 
105  if (!m_HeaderPrinted)
106  {
107  header.append(profiling::CentreAlignFormatting(" Timestamp", 11));
108  header.append(" | ");
109  header.append(profiling::CentreAlignFormatting("Period (us)", 13));
110  header.append(" | ");
111  header.append(profiling::CentreAlignFormatting("UID's", static_cast<int>(uidString.size())));
112  header.append(" | ");
113  header.append(profiling::CentreAlignFormatting("Values", 10));
114  header.append("\n");
115 
116  std::cout << header;
117  m_HeaderPrinted = true;
118  }
119 
120  std::cout << std::string(body.size(), '-') << "\n";
121 
122  std::cout << body;
123  }
124 }
std::string CentreAlignFormatting(const std::string &stringToPass, const int spacingWidth)

Member Data Documentation

◆ m_CounterCaptureValues

◆ m_CurrentPeriodValue

uint64_t m_CurrentPeriodValue = 0

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