ArmNN  NotReleased
RegisterBackendCounters Class Reference

#include <RegisterBackendCounters.hpp>

Inheritance diagram for RegisterBackendCounters:
IRegisterBackendCounters

Public Member Functions

 RegisterBackendCounters (uint16_t currentMaxGlobalCounterID, const BackendId &backendId)
 
 ~RegisterBackendCounters ()=default
 
void RegisterCategory (const std::string &categoryName, const Optional< uint16_t > &deviceUid=EmptyOptional(), const Optional< uint16_t > &counterSetUid=EmptyOptional()) override
 
uint16_t RegisterDevice (const std::string &deviceName, uint16_t cores=0, const Optional< std::string > &parentCategoryName=EmptyOptional()) override
 
uint16_t RegisterCounterSet (const std::string &counterSetName, uint16_t count=0, const Optional< std::string > &parentCategoryName=EmptyOptional()) override
 
uint16_t RegisterCounter (const uint16_t uid, const std::string &parentCategoryName, uint16_t counterClass, uint16_t interpolation, double multiplier, const std::string &name, const std::string &description, const Optional< std::string > &units=EmptyOptional(), const Optional< uint16_t > &numberOfCores=EmptyOptional(), const Optional< uint16_t > &deviceUid=EmptyOptional(), const Optional< uint16_t > &counterSetUid=EmptyOptional()) override
 
- Public Member Functions inherited from IRegisterBackendCounters
virtual ~IRegisterBackendCounters ()
 

Detailed Description

Definition at line 19 of file RegisterBackendCounters.hpp.

Constructor & Destructor Documentation

◆ RegisterBackendCounters()

RegisterBackendCounters ( uint16_t  currentMaxGlobalCounterID,
const BackendId backendId 
)
inline

Definition at line 23 of file RegisterBackendCounters.hpp.

References RegisterBackendCounters::RegisterCategory(), RegisterBackendCounters::RegisterCounter(), RegisterBackendCounters::RegisterCounterSet(), RegisterBackendCounters::RegisterDevice(), and RegisterBackendCounters::~RegisterBackendCounters().

24  : m_CurrentMaxGlobalCounterID(currentMaxGlobalCounterID),
25  m_CounterDirectory(ProfilingService::Instance().GetCounterRegistry()),
26  m_BackendId(backendId) {}
static ProfilingService & Instance()

◆ ~RegisterBackendCounters()

Member Function Documentation

◆ RegisterCategory()

void RegisterCategory ( const std::string &  categoryName,
const Optional< uint16_t > &  deviceUid = EmptyOptional(),
const Optional< uint16_t > &  counterSetUid = EmptyOptional() 
)
overridevirtual

Implements IRegisterBackendCounters.

Definition at line 14 of file RegisterBackendCounters.cpp.

References ICounterRegistry::RegisterCategory().

Referenced by BOOST_AUTO_TEST_CASE(), and RegisterBackendCounters::RegisterBackendCounters().

17 {
18  m_CounterDirectory.RegisterCategory(categoryName, deviceUid, counterSetUid);
19 }
virtual const Category * RegisterCategory(const std::string &categoryName, const Optional< uint16_t > &deviceUid, const Optional< uint16_t > &counterSetUid)=0

◆ RegisterCounter()

uint16_t RegisterCounter ( const uint16_t  uid,
const std::string &  parentCategoryName,
uint16_t  counterClass,
uint16_t  interpolation,
double  multiplier,
const std::string &  name,
const std::string &  description,
const Optional< std::string > &  units = EmptyOptional(),
const Optional< uint16_t > &  numberOfCores = EmptyOptional(),
const Optional< uint16_t > &  deviceUid = EmptyOptional(),
const Optional< uint16_t > &  counterSetUid = EmptyOptional() 
)
overridevirtual

Implements IRegisterBackendCounters.

Definition at line 37 of file RegisterBackendCounters.cpp.

References ProfilingService::GetCounterMappingRegistry(), ProfilingService::Instance(), Counter::m_MaxCounterUid, Counter::m_Uid, ICounterRegistry::RegisterCounter(), and IRegisterCounterMapping::RegisterMapping().

Referenced by BOOST_AUTO_TEST_CASE(), and RegisterBackendCounters::RegisterBackendCounters().

48 {
49  ++m_CurrentMaxGlobalCounterID;
50  const Counter* counterPtr = m_CounterDirectory.RegisterCounter(m_BackendId,
51  m_CurrentMaxGlobalCounterID,
52  parentCategoryName,
53  counterClass,
54  interpolation,
55  multiplier,
56  name,
57  description,
58  units,
59  numberOfCores,
60  deviceUid,
61  counterSetUid);
62  m_CurrentMaxGlobalCounterID = counterPtr->m_MaxCounterUid;
63  // register mappings
64  IRegisterCounterMapping& counterIdMap = ProfilingService::Instance().GetCounterMappingRegistry();
65  uint16_t globalCounterId = counterPtr->m_Uid;
66  if (globalCounterId == counterPtr->m_MaxCounterUid)
67  {
68  counterIdMap.RegisterMapping(globalCounterId, uid, m_BackendId);
69  }
70  else
71  {
72  uint16_t backendCounterId = uid;
73  while (globalCounterId <= counterPtr->m_MaxCounterUid)
74  {
75  // register mapping
76  // globalCounterId -> backendCounterId, m_BackendId
77  counterIdMap.RegisterMapping(globalCounterId, backendCounterId, m_BackendId);
78  ++globalCounterId;
79  ++backendCounterId;
80  }
81  }
82  return m_CurrentMaxGlobalCounterID;
83 }
IRegisterCounterMapping & GetCounterMappingRegistry()
static ProfilingService & Instance()
virtual void RegisterMapping(uint16_t globalCounterId, uint16_t backendCounterId, const armnn::BackendId &backendId)=0
virtual const Counter * RegisterCounter(const BackendId &backendId, const uint16_t uid, const std::string &parentCategoryName, uint16_t counterClass, uint16_t interpolation, double multiplier, const std::string &name, const std::string &description, const Optional< std::string > &units, const Optional< uint16_t > &numberOfCores, const Optional< uint16_t > &deviceUid, const Optional< uint16_t > &counterSetUid)=0

◆ RegisterCounterSet()

uint16_t RegisterCounterSet ( const std::string &  counterSetName,
uint16_t  count = 0,
const Optional< std::string > &  parentCategoryName = EmptyOptional() 
)
overridevirtual

Implements IRegisterBackendCounters.

Definition at line 29 of file RegisterBackendCounters.cpp.

References CounterSet::m_Uid, and ICounterRegistry::RegisterCounterSet().

Referenced by BOOST_AUTO_TEST_CASE(), and RegisterBackendCounters::RegisterBackendCounters().

32 {
33  const CounterSet* counterSetPtr = m_CounterDirectory.RegisterCounterSet(counterSetName, count, parentCategoryName);
34  return counterSetPtr->m_Uid;
35 }
virtual const CounterSet * RegisterCounterSet(const std::string &counterSetName, uint16_t count, const Optional< std::string > &parentCategoryName)=0

◆ RegisterDevice()

uint16_t RegisterDevice ( const std::string &  deviceName,
uint16_t  cores = 0,
const Optional< std::string > &  parentCategoryName = EmptyOptional() 
)
overridevirtual

Implements IRegisterBackendCounters.

Definition at line 21 of file RegisterBackendCounters.cpp.

References Device::m_Uid, and ICounterRegistry::RegisterDevice().

Referenced by BOOST_AUTO_TEST_CASE(), and RegisterBackendCounters::RegisterBackendCounters().

24 {
25  const Device* devicePtr = m_CounterDirectory.RegisterDevice(deviceName, cores, parentCategoryName);
26  return devicePtr->m_Uid;
27 }
virtual const Device * RegisterDevice(const std::string &deviceName, uint16_t cores, const Optional< std::string > &parentCategoryName)=0

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