From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- ...eriodic_counter_selection_command_handler.xhtml | 283 +++++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 21.02/classarmnn_1_1profiling_1_1_periodic_counter_selection_command_handler.xhtml (limited to '21.02/classarmnn_1_1profiling_1_1_periodic_counter_selection_command_handler.xhtml') diff --git a/21.02/classarmnn_1_1profiling_1_1_periodic_counter_selection_command_handler.xhtml b/21.02/classarmnn_1_1profiling_1_1_periodic_counter_selection_command_handler.xhtml new file mode 100644 index 0000000000..605190800b --- /dev/null +++ b/21.02/classarmnn_1_1profiling_1_1_periodic_counter_selection_command_handler.xhtml @@ -0,0 +1,283 @@ + + + + + + + + + + + + + +ArmNN: PeriodicCounterSelectionCommandHandler Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
PeriodicCounterSelectionCommandHandler Class Reference
+
+
+ +

#include <PeriodicCounterSelectionCommandHandler.hpp>

+
+Inheritance diagram for PeriodicCounterSelectionCommandHandler:
+
+
+ + + +
+ + + + + + +

+Public Member Functions

 PeriodicCounterSelectionCommandHandler (uint32_t familyId, uint32_t packetId, uint32_t version, const std::unordered_map< BackendId, std::shared_ptr< armnn::profiling::IBackendProfilingContext >> &backendProfilingContexts, const ICounterMappings &counterIdMap, Holder &captureDataHolder, const uint16_t maxArmnnCounterId, IPeriodicCounterCapture &periodicCounterCapture, const IReadCounterValues &readCounterValue, ISendCounterPacket &sendCounterPacket, const ProfilingStateMachine &profilingStateMachine)
 
void operator() (const arm::pipe::Packet &packet) override
 
+

Detailed Description

+
+

Definition at line 31 of file PeriodicCounterSelectionCommandHandler.hpp.

+

Constructor & Destructor Documentation

+ +

◆ PeriodicCounterSelectionCommandHandler()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PeriodicCounterSelectionCommandHandler (uint32_t familyId,
uint32_t packetId,
uint32_t version,
const std::unordered_map< BackendId, std::shared_ptr< armnn::profiling::IBackendProfilingContext >> & backendProfilingContexts,
const ICounterMappingscounterIdMap,
HoldercaptureDataHolder,
const uint16_t maxArmnnCounterId,
IPeriodicCounterCaptureperiodicCounterCapture,
const IReadCounterValuesreadCounterValue,
ISendCounterPacketsendCounterPacket,
const ProfilingStateMachineprofilingStateMachine 
)
+
+inline
+
+ +

Definition at line 35 of file PeriodicCounterSelectionCommandHandler.hpp.

+ +

References ARMNN_LOG, OptionalBase::has_value(), PeriodicCounterSelectionCommandHandler::operator()(), OptionalReferenceSwitch< IsReference, T >::value(), and armnn::warning.

+
48  : CommandHandlerFunctor(familyId, packetId, version)
49  , m_BackendProfilingContexts(backendProfilingContexts)
50  , m_CounterIdMap(counterIdMap)
51  , m_CaptureDataHolder(captureDataHolder)
52  , m_MaxArmCounterId(maxArmnnCounterId)
53  , m_PeriodicCounterCapture(periodicCounterCapture)
54  , m_PrevCapturePeriod(0)
55  , m_ReadCounterValues(readCounterValue)
56  , m_SendCounterPacket(sendCounterPacket)
57  , m_StateMachine(profilingStateMachine)
58 
59  {
60 
61  }
+
+
+

Member Function Documentation

+ +

◆ operator()()

+ +
+
+ + + + + +
+ + + + + + + + +
void operator() (const arm::pipe::Packet & packet)
+
+override
+
+ +

Definition at line 60 of file PeriodicCounterSelectionCommandHandler.cpp.

+ +

References armnn::profiling::Active, CaptureData::GetActiveBackends(), ICounterMappings::GetBackendId(), Holder::GetCaptureData(), CaptureData::GetCapturePeriod(), CaptureData::GetCounterIds(), ProfilingStateMachine::GetCurrentState(), armnn::profiling::GetProfilingStateName(), IReadCounterValues::IsCounterRegistered(), armnn::LOWEST_CAPTURE_PERIOD, armnn::profiling::NotConnected, ISendCounterPacket::SendPeriodicCounterSelectionPacket(), Holder::SetCaptureData(), IPeriodicCounterCapture::Start(), IPeriodicCounterCapture::Stop(), armnn::profiling::Uninitialised, and armnn::profiling::WaitingForAck.

+ +

Referenced by PeriodicCounterSelectionCommandHandler::PeriodicCounterSelectionCommandHandler().

+
61 {
62  ProfilingState currentState = m_StateMachine.GetCurrentState();
63  switch (currentState)
64  {
68  throw RuntimeException(fmt::format("Periodic Counter Selection Command Handler invoked while in "
69  "an wrong state: {}",
70  GetProfilingStateName(currentState)));
72  {
73  // Process the packet
74  if (!(packet.GetPacketFamily() == 0u && packet.GetPacketId() == 4u))
75  {
76  throw armnn::InvalidArgumentException(fmt::format("Expected Packet family = 0, id = 4 but "
77  "received family = {}, id = {}",
78  packet.GetPacketFamily(),
79  packet.GetPacketId()));
80  }
81 
82  // Parse the packet to get the capture period and counter UIDs
83  CaptureData captureData;
84  ParseData(packet, captureData);
85 
86  // Get the capture data
87  uint32_t capturePeriod = captureData.GetCapturePeriod();
88  // Validate that the capture period is within the acceptable range.
89  if (capturePeriod > 0 && capturePeriod < LOWEST_CAPTURE_PERIOD)
90  {
91  capturePeriod = LOWEST_CAPTURE_PERIOD;
92  }
93  const std::vector<uint16_t>& counterIds = captureData.GetCounterIds();
94 
95  // Check whether the selected counter UIDs are valid
96  std::vector<uint16_t> validCounterIds;
97  for (uint16_t counterId : counterIds)
98  {
99  // Check whether the counter is registered
100  if (!m_ReadCounterValues.IsCounterRegistered(counterId))
101  {
102  // Invalid counter UID, ignore it and continue
103  continue;
104  }
105  // The counter is valid
106  validCounterIds.emplace_back(counterId);
107  }
108 
109  std::sort(validCounterIds.begin(), validCounterIds.end());
110 
111  auto backendIdStart = std::find_if(validCounterIds.begin(), validCounterIds.end(), [&](uint16_t& counterId)
112  {
113  return counterId > m_MaxArmCounterId;
114  });
115 
116  std::set<armnn::BackendId> activeBackends;
117  std::set<uint16_t> backendCounterIds = std::set<uint16_t>(backendIdStart, validCounterIds.end());
118 
119  if (m_BackendCounterMap.size() != 0)
120  {
121  std::set<uint16_t> newCounterIds;
122  std::set<uint16_t> unusedCounterIds;
123 
124  // Get any backend counter ids that is in backendCounterIds but not in m_PrevBackendCounterIds
125  std::set_difference(backendCounterIds.begin(), backendCounterIds.end(),
126  m_PrevBackendCounterIds.begin(), m_PrevBackendCounterIds.end(),
127  std::inserter(newCounterIds, newCounterIds.begin()));
128 
129  // Get any backend counter ids that is in m_PrevBackendCounterIds but not in backendCounterIds
130  std::set_difference(m_PrevBackendCounterIds.begin(), m_PrevBackendCounterIds.end(),
131  backendCounterIds.begin(), backendCounterIds.end(),
132  std::inserter(unusedCounterIds, unusedCounterIds.begin()));
133 
134  activeBackends = ProcessBackendCounterIds(capturePeriod, newCounterIds, unusedCounterIds);
135  }
136  else
137  {
138  activeBackends = ProcessBackendCounterIds(capturePeriod, backendCounterIds, {});
139  }
140 
141  // save the new backend counter ids for next time
142  m_PrevBackendCounterIds = backendCounterIds;
143 
144  // Set the capture data with only the valid armnn counter UIDs
145  m_CaptureDataHolder.SetCaptureData(capturePeriod, {validCounterIds.begin(), backendIdStart}, activeBackends);
146 
147  // Echo back the Periodic Counter Selection packet to the Counter Stream Buffer
148  m_SendCounterPacket.SendPeriodicCounterSelectionPacket(capturePeriod, validCounterIds);
149 
150  if (capturePeriod == 0 || validCounterIds.empty())
151  {
152  // No data capture stop the thread
153  m_PeriodicCounterCapture.Stop();
154  }
155  else
156  {
157  // Start the Period Counter Capture thread (if not running already)
158  m_PeriodicCounterCapture.Start();
159  }
160 
161  break;
162  }
163  default:
164  throw RuntimeException(fmt::format("Unknown profiling service state: {}",
165  static_cast<int>(currentState)));
166  }
167 }
+ +
virtual void SendPeriodicCounterSelectionPacket(uint32_t capturePeriod, const std::vector< uint16_t > &selectedCounterIds)=0
Create and write a PeriodicCounterSelectionPacket from the parameters to the buffer.
+ + +
void SetCaptureData(uint32_t capturePeriod, const std::vector< uint16_t > &counterIds, const std::set< armnn::BackendId > &activeBackends)
Definition: Holder.cpp:74
+ +
constexpr unsigned int LOWEST_CAPTURE_PERIOD
The lowest performance data capture interval we support is 10 miliseconds.
Definition: Types.hpp:21
+
virtual bool IsCounterRegistered(uint16_t counterUid) const =0
+ + + + +
constexpr char const * GetProfilingStateName(ProfilingState state)
+
+
+
+
The documentation for this class was generated from the following files: +
+
+ + + + -- cgit v1.2.1