ArmNN
 22.05
MockBackendProfilingContext Class Reference

#include <MockBackend.hpp>

Inheritance diagram for MockBackendProfilingContext:

Public Member Functions

 MockBackendProfilingContext (IBackendInternal::IBackendProfilingPtr &backendProfiling)
 
 ~MockBackendProfilingContext ()=default
 
IBackendInternal::IBackendProfilingPtrGetBackendProfiling ()
 
uint16_t RegisterCounters (uint16_t currentMaxGlobalCounterId)
 
arm::pipe::Optional< std::string > ActivateCounters (uint32_t capturePeriod, const std::vector< uint16_t > &counterIds)
 
std::vector< arm::pipe::Timestamp > ReportCounterValues ()
 
bool EnableProfiling (bool)
 
bool EnableTimelineReporting (bool isEnabled)
 
bool TimelineReportingEnabled ()
 

Detailed Description

Definition at line 129 of file MockBackend.hpp.

Constructor & Destructor Documentation

◆ MockBackendProfilingContext()

Definition at line 132 of file MockBackend.hpp.

133  : m_BackendProfiling(std::move(backendProfiling))
134  , m_CapturePeriod(0)
135  , m_IsTimelineEnabled(true)
136  {}

◆ ~MockBackendProfilingContext()

Member Function Documentation

◆ ActivateCounters()

arm::pipe::Optional<std::string> ActivateCounters ( uint32_t  capturePeriod,
const std::vector< uint16_t > &  counterIds 
)
inline

Definition at line 165 of file MockBackend.hpp.

166  {
167  if (capturePeriod == 0 || counterIds.size() == 0)
168  {
169  m_ActiveCounters.clear();
170  }
171  else if (capturePeriod == 15939u)
172  {
173  return arm::pipe::Optional<std::string>("ActivateCounters example test error");
174  }
175  m_CapturePeriod = capturePeriod;
176  m_ActiveCounters = counterIds;
177  return arm::pipe::Optional<std::string>();
178  }

◆ EnableProfiling()

bool EnableProfiling ( bool  )
inline

Definition at line 193 of file MockBackend.hpp.

194  {
195  auto sendTimelinePacket = m_BackendProfiling->GetSendTimelinePacket();
196  sendTimelinePacket->SendTimelineEntityBinaryPacket(4256);
197  sendTimelinePacket->Commit();
198  return true;
199  }

◆ EnableTimelineReporting()

bool EnableTimelineReporting ( bool  isEnabled)
inline

Definition at line 201 of file MockBackend.hpp.

202  {
203  m_IsTimelineEnabled = isEnabled;
204  return isEnabled;
205  }

◆ GetBackendProfiling()

IBackendInternal::IBackendProfilingPtr& GetBackendProfiling ( )
inline

Definition at line 140 of file MockBackend.hpp.

Referenced by TEST_SUITE().

141  {
142  return m_BackendProfiling;
143  }

◆ RegisterCounters()

uint16_t RegisterCounters ( uint16_t  currentMaxGlobalCounterId)
inline

Definition at line 145 of file MockBackend.hpp.

146  {
147  std::unique_ptr<arm::pipe::IRegisterBackendCounters> counterRegistrar =
148  m_BackendProfiling->GetCounterRegistrationInterface(static_cast<uint16_t>(currentMaxGlobalCounterId));
149 
150  std::string categoryName("MockCounters");
151  counterRegistrar->RegisterCategory(categoryName);
152 
153  counterRegistrar->RegisterCounter(0, categoryName, 0, 0, 1.f, "Mock Counter One", "Some notional counter");
154 
155  counterRegistrar->RegisterCounter(1, categoryName, 0, 0, 1.f, "Mock Counter Two",
156  "Another notional counter");
157 
158  std::string units("microseconds");
159  uint16_t nextMaxGlobalCounterId =
160  counterRegistrar->RegisterCounter(2, categoryName, 0, 0, 1.f, "Mock MultiCore Counter",
161  "A dummy four core counter", units, 4);
162  return nextMaxGlobalCounterId;
163  }

◆ ReportCounterValues()

std::vector<arm::pipe::Timestamp> ReportCounterValues ( )
inline

Definition at line 180 of file MockBackend.hpp.

181  {
182  std::vector<arm::pipe::CounterValue> counterValues;
183 
184  for (auto counterId : m_ActiveCounters)
185  {
186  counterValues.emplace_back(arm::pipe::CounterValue{ counterId, counterId + 1u });
187  }
188 
189  uint64_t timestamp = m_CapturePeriod;
190  return { arm::pipe::Timestamp{ timestamp, counterValues } };
191  }

◆ TimelineReportingEnabled()

bool TimelineReportingEnabled ( )
inline

Definition at line 207 of file MockBackend.hpp.

208  {
209  return m_IsTimelineEnabled;
210  }

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