ArmNN
 21.08
MockBackendProfilingContext Class Reference

#include <MockBackend.hpp>

Inheritance diagram for MockBackendProfilingContext:
IBackendProfilingContext

Public Member Functions

 MockBackendProfilingContext (IBackendInternal::IBackendProfilingPtr &backendProfiling)
 
 ~MockBackendProfilingContext ()=default
 
IBackendInternal::IBackendProfilingPtrGetBackendProfiling ()
 
uint16_t RegisterCounters (uint16_t currentMaxGlobalCounterId)
 
Optional< std::string > ActivateCounters (uint32_t capturePeriod, const std::vector< uint16_t > &counterIds)
 
std::vector< profiling::TimestampReportCounterValues ()
 
bool EnableProfiling (bool)
 
bool EnableTimelineReporting (bool isEnabled)
 
bool TimelineReportingEnabled ()
 
- Public Member Functions inherited from IBackendProfilingContext
virtual ~IBackendProfilingContext ()
 

Detailed Description

Definition at line 29 of file MockBackend.hpp.

Constructor & Destructor Documentation

◆ MockBackendProfilingContext()

Definition at line 32 of file MockBackend.hpp.

33  : m_BackendProfiling(std::move(backendProfiling))
34  , m_CapturePeriod(0)
35  , m_IsTimelineEnabled(true)
36  {}

◆ ~MockBackendProfilingContext()

Member Function Documentation

◆ ActivateCounters()

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

Implements IBackendProfilingContext.

Definition at line 65 of file MockBackend.hpp.

66  {
67  if (capturePeriod == 0 || counterIds.size() == 0)
68  {
69  m_ActiveCounters.clear();
70  }
71  else if (capturePeriod == 15939u)
72  {
73  return armnn::Optional<std::string>("ActivateCounters example test error");
74  }
75  m_CapturePeriod = capturePeriod;
76  m_ActiveCounters = counterIds;
78  }

◆ EnableProfiling()

bool EnableProfiling ( bool  )
inlinevirtual

Implements IBackendProfilingContext.

Definition at line 93 of file MockBackend.hpp.

94  {
95  auto sendTimelinePacket = m_BackendProfiling->GetSendTimelinePacket();
96  sendTimelinePacket->SendTimelineEntityBinaryPacket(4256);
97  sendTimelinePacket->Commit();
98  return true;
99  }

◆ EnableTimelineReporting()

bool EnableTimelineReporting ( bool  isEnabled)
inlinevirtual

Implements IBackendProfilingContext.

Definition at line 101 of file MockBackend.hpp.

102  {
103  m_IsTimelineEnabled = isEnabled;
104  return isEnabled;
105  }

◆ GetBackendProfiling()

IBackendInternal::IBackendProfilingPtr& GetBackendProfiling ( )
inline

Definition at line 40 of file MockBackend.hpp.

Referenced by TEST_SUITE().

41  {
42  return m_BackendProfiling;
43  }

◆ RegisterCounters()

uint16_t RegisterCounters ( uint16_t  currentMaxGlobalCounterId)
inlinevirtual

Implements IBackendProfilingContext.

Definition at line 45 of file MockBackend.hpp.

46  {
47  std::unique_ptr<profiling::IRegisterBackendCounters> counterRegistrar =
48  m_BackendProfiling->GetCounterRegistrationInterface(static_cast<uint16_t>(currentMaxGlobalCounterId));
49 
50  std::string categoryName("MockCounters");
51  counterRegistrar->RegisterCategory(categoryName);
52 
53  counterRegistrar->RegisterCounter(0, categoryName, 0, 0, 1.f, "Mock Counter One", "Some notional counter");
54 
55  counterRegistrar->RegisterCounter(1, categoryName, 0, 0, 1.f, "Mock Counter Two",
56  "Another notional counter");
57 
58  std::string units("microseconds");
59  uint16_t nextMaxGlobalCounterId =
60  counterRegistrar->RegisterCounter(2, categoryName, 0, 0, 1.f, "Mock MultiCore Counter",
61  "A dummy four core counter", units, 4);
62  return nextMaxGlobalCounterId;
63  }

◆ ReportCounterValues()

std::vector<profiling::Timestamp> ReportCounterValues ( )
inlinevirtual

Implements IBackendProfilingContext.

Definition at line 80 of file MockBackend.hpp.

81  {
82  std::vector<profiling::CounterValue> counterValues;
83 
84  for (auto counterId : m_ActiveCounters)
85  {
86  counterValues.emplace_back(profiling::CounterValue{ counterId, counterId + 1u });
87  }
88 
89  uint64_t timestamp = m_CapturePeriod;
90  return { profiling::Timestamp{ timestamp, counterValues } };
91  }

◆ TimelineReportingEnabled()

bool TimelineReportingEnabled ( )
inline

Definition at line 107 of file MockBackend.hpp.

108  {
109  return m_IsTimelineEnabled;
110  }

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