From 6940dd720ebb6b3d1df8ca203ab696daefe58189 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Fri, 20 Mar 2020 12:25:56 +0000 Subject: renamed Documentation folder 20.02 and added .nojekyll file Signed-off-by: Jim Flynn --- ...eriodic_counter_selection_command_handler.xhtml | 298 +++++++++++++++++++++ 1 file changed, 298 insertions(+) create mode 100644 20.02/classarmnn_1_1profiling_1_1_periodic_counter_selection_command_handler.xhtml (limited to '20.02/classarmnn_1_1profiling_1_1_periodic_counter_selection_command_handler.xhtml') diff --git a/20.02/classarmnn_1_1profiling_1_1_periodic_counter_selection_command_handler.xhtml b/20.02/classarmnn_1_1profiling_1_1_periodic_counter_selection_command_handler.xhtml new file mode 100644 index 0000000000..19b1fccdf9 --- /dev/null +++ b/20.02/classarmnn_1_1profiling_1_1_periodic_counter_selection_command_handler.xhtml @@ -0,0 +1,298 @@ + + + + + + + + + + + + + +ArmNN: PeriodicCounterSelectionCommandHandler Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
PeriodicCounterSelectionCommandHandler Class Reference
+
+
+ +

#include <PeriodicCounterSelectionCommandHandler.hpp>

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

+Public Member Functions

 PeriodicCounterSelectionCommandHandler (uint32_t familyId, uint32_t packetId, uint32_t version, const std::unordered_map< BackendId, std::shared_ptr< armnn::profiling::IBackendProfilingContext >> &backendProfilingContext, const ICounterMappings &counterIdMap, Holder &captureDataHolder, const uint16_t maxArmnnCounterId, IPeriodicCounterCapture &periodicCounterCapture, const IReadCounterValues &readCounterValue, ISendCounterPacket &sendCounterPacket, const ProfilingStateMachine &profilingStateMachine)
 
void operator() (const 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 ()
 
+

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 >> & backendProfilingContext,
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< std::is_reference< T >::value, T >::value(), and armnn::warning.

+
48  : CommandHandlerFunctor(familyId, packetId, version)
49  , m_BackendProfilingContext(backendProfilingContext)
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  }
CommandHandlerFunctor(uint32_t familyId, uint32_t packetId, uint32_t version)
+
+
+
+

Member Function Documentation

+ +

◆ operator()()

+ +
+
+ + + + + +
+ + + + + + + + +
void operator() (const Packetpacket)
+
+overridevirtual
+
+ +

Implements CommandHandlerFunctor.

+ +

Definition at line 59 of file PeriodicCounterSelectionCommandHandler.cpp.

+ +

References armnn::profiling::Active, CaptureData::GetActiveBackends(), ICounterMappings::GetBackendId(), Holder::GetCaptureData(), CaptureData::GetCapturePeriod(), CaptureData::GetCounterIds(), ProfilingStateMachine::GetCurrentState(), Packet::GetPacketFamily(), Packet::GetPacketId(), 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().

+
60 {
61  ProfilingState currentState = m_StateMachine.GetCurrentState();
62  switch (currentState)
63  {
67  throw RuntimeException(boost::str(boost::format("Periodic Counter Selection Command Handler invoked while in "
68  "an wrong state: %1%")
69  % GetProfilingStateName(currentState)));
71  {
72  // Process the packet
73  if (!(packet.GetPacketFamily() == 0u && packet.GetPacketId() == 4u))
74  {
75  throw armnn::InvalidArgumentException(boost::str(boost::format("Expected Packet family = 0, id = 4 but "
76  "received family = %1%, id = %2%")
77  % packet.GetPacketFamily()
78  % packet.GetPacketId()));
79  }
80 
81  // Parse the packet to get the capture period and counter UIDs
82  CaptureData captureData;
83  ParseData(packet, captureData);
84 
85  // Get the capture data
86  uint32_t capturePeriod = captureData.GetCapturePeriod();
87  // Validate that the capture period is within the acceptable range.
88  if (capturePeriod > 0 && capturePeriod < LOWEST_CAPTURE_PERIOD)
89  {
90  capturePeriod = LOWEST_CAPTURE_PERIOD;
91  }
92  const std::vector<uint16_t>& counterIds = captureData.GetCounterIds();
93 
94  // Check whether the selected counter UIDs are valid
95  std::vector<uint16_t> validCounterIds;
96  for (uint16_t counterId : counterIds)
97  {
98  // Check whether the counter is registered
99  if (!m_ReadCounterValues.IsCounterRegistered(counterId))
100  {
101  // Invalid counter UID, ignore it and continue
102  continue;
103  }
104  // The counter is valid
105  validCounterIds.emplace_back(counterId);
106  }
107 
108  std::sort(validCounterIds.begin(), validCounterIds.end());
109 
110  auto backendIdStart = std::find_if(validCounterIds.begin(), validCounterIds.end(), [&](uint16_t& counterId)
111  {
112  return counterId > m_MaxArmCounterId;
113  });
114 
115  std::set<armnn::BackendId> activeBackends;
116  std::set<uint16_t> backendCounterIds = std::set<uint16_t>(backendIdStart, validCounterIds.end());
117 
118  if (m_BackendCounterMap.size() != 0)
119  {
120  std::set<uint16_t> newCounterIds;
121  std::set<uint16_t> unusedCounterIds;
122 
123  // Get any backend counter ids that is in backendCounterIds but not in m_PrevBackendCounterIds
124  std::set_difference(backendCounterIds.begin(), backendCounterIds.end(),
125  m_PrevBackendCounterIds.begin(), m_PrevBackendCounterIds.end(),
126  std::inserter(newCounterIds, newCounterIds.begin()));
127 
128  // Get any backend counter ids that is in m_PrevBackendCounterIds but not in backendCounterIds
129  std::set_difference(m_PrevBackendCounterIds.begin(), m_PrevBackendCounterIds.end(),
130  backendCounterIds.begin(), backendCounterIds.end(),
131  std::inserter(unusedCounterIds, unusedCounterIds.begin()));
132 
133  activeBackends = ProcessBackendCounterIds(capturePeriod, newCounterIds, unusedCounterIds);
134  }
135  else
136  {
137  activeBackends = ProcessBackendCounterIds(capturePeriod, backendCounterIds, {});
138  }
139 
140  // save the new backend counter ids for next time
141  m_PrevBackendCounterIds = backendCounterIds;
142 
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(boost::str(boost::format("Unknown profiling service state: %1%")
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