ArmNN
 20.05
CounterDirectory Class Referencefinal

#include <CounterDirectory.hpp>

Inheritance diagram for CounterDirectory:
ICounterDirectory ICounterRegistry

Public Member Functions

 CounterDirectory ()=default
 
 ~CounterDirectory ()=default
 
const CategoryRegisterCategory (const std::string &categoryName) override
 
const DeviceRegisterDevice (const std::string &deviceName, uint16_t cores=0, const Optional< std::string > &parentCategoryName=EmptyOptional()) override
 
const CounterSetRegisterCounterSet (const std::string &counterSetName, uint16_t count=0, const Optional< std::string > &parentCategoryName=EmptyOptional()) override
 
const CounterRegisterCounter (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=EmptyOptional(), const Optional< uint16_t > &numberOfCores=EmptyOptional(), const Optional< uint16_t > &deviceUid=EmptyOptional(), const Optional< uint16_t > &counterSetUid=EmptyOptional()) override
 
uint16_t GetCategoryCount () const override
 
uint16_t GetDeviceCount () const override
 
uint16_t GetCounterSetCount () const override
 
uint16_t GetCounterCount () const override
 
const CategoriesGetCategories () const override
 
const DevicesGetDevices () const override
 
const CounterSetsGetCounterSets () const override
 
const CountersGetCounters () const override
 
const CategoryGetCategory (const std::string &name) const override
 
const DeviceGetDevice (uint16_t uid) const override
 
const CounterSetGetCounterSet (uint16_t uid) const override
 
const CounterGetCounter (uint16_t uid) const override
 
bool IsCategoryRegistered (const std::string &categoryName) const
 
bool IsDeviceRegistered (uint16_t deviceUid) const
 
bool IsDeviceRegistered (const std::string &deviceName) const
 
bool IsCounterSetRegistered (uint16_t counterSetUid) const
 
bool IsCounterSetRegistered (const std::string &counterSetName) const
 
bool IsCounterRegistered (uint16_t counterUid) const
 
bool IsCounterRegistered (const std::string &counterName) const
 
void Clear ()
 
- Public Member Functions inherited from ICounterDirectory
virtual ~ICounterDirectory ()
 
- Public Member Functions inherited from ICounterRegistry
virtual ~ICounterRegistry ()
 

Detailed Description

Definition at line 23 of file CounterDirectory.hpp.

Constructor & Destructor Documentation

◆ CounterDirectory()

CounterDirectory ( )
default

◆ ~CounterDirectory()

~CounterDirectory ( )
default

Member Function Documentation

◆ Clear()

void Clear ( )

Definition at line 440 of file CounterDirectory.cpp.

References ARMNN_ASSERT, OptionalBase::has_value(), and OptionalReferenceSwitch< std::is_reference< T >::value, T >::value().

Referenced by CounterDirectory::GetCounters(), and ProfilingService::GetSendTimelinePacket().

441 {
442  // Clear all the counter directory contents
443  m_Categories.clear();
444  m_Devices.clear();
445  m_CounterSets.clear();
446  m_Counters.clear();
447 }

◆ GetCategories()

const Categories& GetCategories ( ) const
inlineoverridevirtual

Implements ICounterDirectory.

Definition at line 57 of file CounterDirectory.hpp.

57 { return m_Categories; }

◆ GetCategory()

const Category * GetCategory ( const std::string &  name) const
overridevirtual

Implements ICounterDirectory.

Definition at line 331 of file CounterDirectory.cpp.

References ARMNN_ASSERT.

Referenced by BOOST_AUTO_TEST_CASE(), and CounterDirectory::GetCounters().

332 {
333  auto it = FindCategory(categoryName);
334  if (it == m_Categories.end())
335  {
336  return nullptr;
337  }
338 
339  const Category* category = it->get();
340  ARMNN_ASSERT(category);
341 
342  return category;
343 }
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14

◆ GetCategoryCount()

uint16_t GetCategoryCount ( ) const
inlineoverridevirtual

Implements ICounterDirectory.

Definition at line 51 of file CounterDirectory.hpp.

References armnn::numeric_cast().

Referenced by BOOST_AUTO_TEST_CASE().

51 { return boost::numeric_cast<uint16_t>(m_Categories.size()); }
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
Definition: NumericCast.hpp:33

◆ GetCounter()

const Counter * GetCounter ( uint16_t  uid) const
overridevirtual

Implements ICounterDirectory.

Definition at line 375 of file CounterDirectory.cpp.

References ARMNN_ASSERT, Counter::m_MaxCounterUid, and Counter::m_Uid.

Referenced by BOOST_AUTO_TEST_CASE(), CounterDirectory::GetCounters(), and CounterDirectory::RegisterCounter().

376 {
377  auto it = FindCounter(counterUid);
378  if (it == m_Counters.end())
379  {
380  return nullptr;
381  }
382 
383  const Counter* counter = it->second.get();
384  ARMNN_ASSERT(counter);
385  ARMNN_ASSERT(counter->m_Uid <= counterUid);
386  ARMNN_ASSERT(counter->m_Uid <= counter->m_MaxCounterUid);
387 
388  return counter;
389 }
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14

◆ GetCounterCount()

uint16_t GetCounterCount ( ) const
inlineoverridevirtual

Implements ICounterDirectory.

Definition at line 54 of file CounterDirectory.hpp.

References armnn::numeric_cast().

Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::GetCounterCount().

54 { return boost::numeric_cast<uint16_t>(m_Counters.size()); }
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
Definition: NumericCast.hpp:33

◆ GetCounters()

◆ GetCounterSet()

const CounterSet * GetCounterSet ( uint16_t  uid) const
overridevirtual

Implements ICounterDirectory.

Definition at line 360 of file CounterDirectory.cpp.

References ARMNN_ASSERT, and CounterSet::m_Uid.

Referenced by BOOST_AUTO_TEST_CASE(), and CounterDirectory::GetCounters().

361 {
362  auto it = FindCounterSet(counterSetUid);
363  if (it == m_CounterSets.end())
364  {
365  return nullptr;
366  }
367 
368  const CounterSet* counterSet = it->second.get();
369  ARMNN_ASSERT(counterSet);
370  ARMNN_ASSERT(counterSet->m_Uid == counterSetUid);
371 
372  return counterSet;
373 }
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14

◆ GetCounterSetCount()

uint16_t GetCounterSetCount ( ) const
inlineoverridevirtual

Implements ICounterDirectory.

Definition at line 53 of file CounterDirectory.hpp.

References armnn::numeric_cast().

Referenced by BOOST_AUTO_TEST_CASE().

53 { return boost::numeric_cast<uint16_t>(m_CounterSets.size()); }
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
Definition: NumericCast.hpp:33

◆ GetCounterSets()

const CounterSets& GetCounterSets ( ) const
inlineoverridevirtual

Implements ICounterDirectory.

Definition at line 59 of file CounterDirectory.hpp.

59 { return m_CounterSets; }

◆ GetDevice()

const Device * GetDevice ( uint16_t  uid) const
overridevirtual

Implements ICounterDirectory.

Definition at line 345 of file CounterDirectory.cpp.

References ARMNN_ASSERT, and Device::m_Uid.

Referenced by BOOST_AUTO_TEST_CASE(), and CounterDirectory::GetCounters().

346 {
347  auto it = FindDevice(deviceUid);
348  if (it == m_Devices.end())
349  {
350  return nullptr;
351  }
352 
353  const Device* device = it->second.get();
354  ARMNN_ASSERT(device);
355  ARMNN_ASSERT(device->m_Uid == deviceUid);
356 
357  return device;
358 }
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14

◆ GetDeviceCount()

uint16_t GetDeviceCount ( ) const
inlineoverridevirtual

Implements ICounterDirectory.

Definition at line 52 of file CounterDirectory.hpp.

References armnn::numeric_cast().

Referenced by BOOST_AUTO_TEST_CASE().

52 { return boost::numeric_cast<uint16_t>(m_Devices.size()); }
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
Definition: NumericCast.hpp:33

◆ GetDevices()

const Devices& GetDevices ( ) const
inlineoverridevirtual

Implements ICounterDirectory.

Definition at line 58 of file CounterDirectory.hpp.

58 { return m_Devices; }

◆ IsCategoryRegistered()

bool IsCategoryRegistered ( const std::string &  categoryName) const

Definition at line 391 of file CounterDirectory.cpp.

Referenced by CounterDirectory::GetCounters(), ProfilingService::GetSendTimelinePacket(), and CounterDirectory::RegisterCategory().

392 {
393  auto it = FindCategory(categoryName);
394 
395  return it != m_Categories.end();
396 }

◆ IsCounterRegistered() [1/2]

bool IsCounterRegistered ( uint16_t  counterUid) const

Definition at line 426 of file CounterDirectory.cpp.

Referenced by CounterDirectory::GetCounters(), ProfilingService::GetSendTimelinePacket(), and ProfilingService::IsCounterRegistered().

427 {
428  auto it = FindCounter(counterUid);
429 
430  return it != m_Counters.end();
431 }

◆ IsCounterRegistered() [2/2]

bool IsCounterRegistered ( const std::string &  counterName) const

Definition at line 433 of file CounterDirectory.cpp.

434 {
435  auto it = FindCounter(counterName);
436 
437  return it != m_Counters.end();
438 }

◆ IsCounterSetRegistered() [1/2]

bool IsCounterSetRegistered ( uint16_t  counterSetUid) const

Definition at line 412 of file CounterDirectory.cpp.

Referenced by CounterDirectory::GetCounters(), CounterDirectory::RegisterCounter(), and CounterDirectory::RegisterCounterSet().

413 {
414  auto it = FindCounterSet(counterSetUid);
415 
416  return it != m_CounterSets.end();
417 }

◆ IsCounterSetRegistered() [2/2]

bool IsCounterSetRegistered ( const std::string &  counterSetName) const

Definition at line 419 of file CounterDirectory.cpp.

420 {
421  auto it = FindCounterSet(counterSetName);
422 
423  return it != m_CounterSets.end();
424 }

◆ IsDeviceRegistered() [1/2]

bool IsDeviceRegistered ( uint16_t  deviceUid) const

Definition at line 398 of file CounterDirectory.cpp.

Referenced by CounterDirectory::GetCounters(), and CounterDirectory::RegisterDevice().

399 {
400  auto it = FindDevice(deviceUid);
401 
402  return it != m_Devices.end();
403 }

◆ IsDeviceRegistered() [2/2]

bool IsDeviceRegistered ( const std::string &  deviceName) const

Definition at line 405 of file CounterDirectory.cpp.

406 {
407  auto it = FindDevice(deviceName);
408 
409  return it != m_Devices.end();
410 }

◆ RegisterCategory()

const Category * RegisterCategory ( const std::string &  categoryName)
overridevirtual

Implements ICounterRegistry.

Definition at line 22 of file CounterDirectory.cpp.

References ARMNN_ASSERT, and CounterDirectory::IsCategoryRegistered().

Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::GetSendTimelinePacket().

23 {
24  // Check that the given category name is valid
25  if (categoryName.empty() ||
26  !IsValidSwTraceString<SwTraceNameCharPolicy>(categoryName))
27  {
28  throw InvalidArgumentException("Trying to register a category with an invalid name");
29  }
30 
31  // Check that the given category is not already registered
32  if (IsCategoryRegistered(categoryName))
33  {
34  throw InvalidArgumentException(
35  boost::str(boost::format("Trying to register a category already registered (\"%1%\")")
36  % categoryName));
37  }
38 
39  // Create the category
40  CategoryPtr category = std::make_unique<Category>(categoryName);
41  ARMNN_ASSERT(category);
42 
43  // Get the raw category pointer
44  const Category* categoryPtr = category.get();
45  ARMNN_ASSERT(categoryPtr);
46 
47  // Register the category
48  m_Categories.insert(std::move(category));
49 
50  return categoryPtr;
51 }
bool IsCategoryRegistered(const std::string &categoryName) const
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
std::unique_ptr< Category > CategoryPtr

◆ RegisterCounter()

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 = EmptyOptional(),
const Optional< uint16_t > &  numberOfCores = EmptyOptional(),
const Optional< uint16_t > &  deviceUid = EmptyOptional(),
const Optional< uint16_t > &  counterSetUid = EmptyOptional() 
)
overridevirtual

Implements ICounterRegistry.

Definition at line 182 of file CounterDirectory.cpp.

References ARMNN_ASSERT, CounterDirectory::GetCounter(), armnn::profiling::GetNextCounterUids(), OptionalBase::has_value(), armnn::IgnoreUnused(), CounterDirectory::IsCounterSetRegistered(), Counter::m_Name, OptionalReferenceSwitch< std::is_reference< T >::value, T >::value(), and OptionalReferenceSwitch< IsReference, T >::value().

Referenced by BOOST_AUTO_TEST_CASE(), and ProfilingService::GetSendTimelinePacket().

194 {
195  IgnoreUnused(backendId);
196 
197  // Check that the given parent category name is valid
198  if (parentCategoryName.empty() ||
199  !IsValidSwTraceString<SwTraceNameCharPolicy>(parentCategoryName))
200  {
201  throw InvalidArgumentException("Trying to register a counter with an invalid parent category name");
202  }
203 
204  // Check that the given class is valid
205  if (counterClass != 0 && counterClass != 1)
206  {
207  throw InvalidArgumentException("Trying to register a counter with an invalid class");
208  }
209 
210  // Check that the given interpolation is valid
211  if (interpolation != 0 && interpolation != 1)
212  {
213  throw InvalidArgumentException("Trying to register a counter with an invalid interpolation");
214  }
215 
216  // Check that the given multiplier is valid
217  if (multiplier == .0f)
218  {
219  throw InvalidArgumentException("Trying to register a counter with an invalid multiplier");
220  }
221 
222  // Check that the given name is valid
223  if (name.empty() ||
224  !IsValidSwTraceString<SwTraceCharPolicy>(name))
225  {
226  throw InvalidArgumentException("Trying to register a counter with an invalid name");
227  }
228 
229  // Check that the given description is valid
230  if (description.empty() ||
231  !IsValidSwTraceString<SwTraceCharPolicy>(description))
232  {
233  throw InvalidArgumentException("Trying to register a counter with an invalid description");
234  }
235 
236  // Check that the given units are valid
237  if (units.has_value()
238  && !IsValidSwTraceString<SwTraceNameCharPolicy>(units.value()))
239  {
240  throw InvalidArgumentException("Trying to register a counter with a invalid units");
241  }
242 
243  // Check that the given parent category is registered
244  auto categoryIt = FindCategory(parentCategoryName);
245  if (categoryIt == m_Categories.end())
246  {
247  throw InvalidArgumentException(
248  boost::str(boost::format("Trying to connect a counter to a category "
249  "that is not registered (name: \"%1%\")")
250  % parentCategoryName));
251  }
252 
253  // Get the parent category
254  const CategoryPtr& parentCategory = *categoryIt;
255  ARMNN_ASSERT(parentCategory);
256 
257  // Check that a counter with the given name is not already registered within the parent category
258  const std::vector<uint16_t>& parentCategoryCounters = parentCategory->m_Counters;
259  for (uint16_t parentCategoryCounterUid : parentCategoryCounters)
260  {
261  const Counter* parentCategoryCounter = GetCounter(parentCategoryCounterUid);
262  ARMNN_ASSERT(parentCategoryCounter);
263 
264  if (parentCategoryCounter->m_Name == name)
265  {
266  throw InvalidArgumentException(
267  boost::str(boost::format("Trying to register a counter to category \"%1%\" with a name that "
268  "is already used within that category (name: \"%2%\")")
269  % parentCategoryName
270  % name));
271  }
272  }
273 
274  // Check that a counter set with the given (optional) UID is already registered
275  uint16_t counterSetUidValue = counterSetUid.has_value() ? counterSetUid.value() : 0;
276  if (counterSetUidValue > 0)
277  {
278  // Check that the (optional) counter set is already registered
279  if (!IsCounterSetRegistered(counterSetUidValue))
280  {
281  throw InvalidArgumentException(
282  boost::str(boost::format("Trying to connect a counter to a counter set that is "
283  "not registered (counter set UID: %1%)")
284  % counterSetUidValue));
285  }
286  }
287 
288  // Get the number of cores (this call may throw)
289  uint16_t deviceUidValue = deviceUid.has_value() ? deviceUid.value() : 0;
290  uint16_t deviceCores = GetNumberOfCores(numberOfCores, deviceUidValue);
291 
292  // Get the counter UIDs and calculate the max counter UID
293  std::vector<uint16_t> counterUids = GetNextCounterUids(uid, deviceCores);
294  ARMNN_ASSERT(!counterUids.empty());
295  uint16_t maxCounterUid = deviceCores <= 1 ? counterUids.front() : counterUids.back();
296 
297  // Get the counter units
298  const std::string unitsValue = units.has_value() ? units.value() : "";
299 
300  // Create the counter
301  CounterPtr counter = std::make_shared<Counter>(armnn::profiling::BACKEND_ID,
302  counterUids.front(),
303  maxCounterUid,
304  counterClass,
305  interpolation,
306  multiplier,
307  name,
308  description,
309  unitsValue,
310  deviceUidValue,
311  counterSetUidValue);
312  ARMNN_ASSERT(counter);
313 
314  // Get the raw counter pointer
315  const Counter* counterPtr = counter.get();
316  ARMNN_ASSERT(counterPtr);
317 
318  // Process multiple counters if necessary
319  for (uint16_t counterUid : counterUids)
320  {
321  // Connect the counter to the parent category
322  parentCategory->m_Counters.push_back(counterUid);
323 
324  // Register the counter
325  m_Counters.insert(std::make_pair(counterUid, counter));
326  }
327 
328  return counterPtr;
329 }
void IgnoreUnused(Ts &&...)
std::shared_ptr< Counter > CounterPtr
bool has_value() const noexcept
Definition: Optional.hpp:53
std::vector< uint16_t > GetNextCounterUids(uint16_t firstUid, uint16_t cores)
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
const Counter * GetCounter(uint16_t uid) const override
std::unique_ptr< Category > CategoryPtr
bool IsCounterSetRegistered(uint16_t counterSetUid) const

◆ RegisterCounterSet()

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

Implements ICounterRegistry.

Definition at line 115 of file CounterDirectory.cpp.

References ARMNN_ASSERT, armnn::profiling::GetNextUid(), OptionalBase::has_value(), CounterDirectory::IsCounterSetRegistered(), and OptionalReferenceSwitch< IsReference, T >::value().

Referenced by BOOST_AUTO_TEST_CASE().

118 {
119  // Check that the given counter set name is valid
120  if (counterSetName.empty() ||
121  !IsValidSwTraceString<SwTraceNameCharPolicy>(counterSetName))
122  {
123  throw InvalidArgumentException("Trying to register a counter set with an invalid name");
124  }
125 
126  // Check that a counter set with the given name is not already registered
127  if (IsCounterSetRegistered(counterSetName))
128  {
129  throw InvalidArgumentException(
130  boost::str(boost::format("Trying to register a counter set already registered (\"%1%\")")
131  % counterSetName));
132  }
133 
134  // Peek the next UID, do not get an actual valid UID just now as we don't want to waste a good UID in case
135  // the registration fails. We'll get a proper one once we're sure that the counter set can be registered
136  uint16_t counterSetUidPeek = GetNextUid(true);
137 
138  // Check that a category with the given (optional) parent category name is already registered
139  if (parentCategoryName.has_value())
140  {
141  // Get the (optional) parent category name
142  const std::string& parentCategoryNameValue = parentCategoryName.value();
143  if (parentCategoryNameValue.empty())
144  {
145  throw InvalidArgumentException(
146  boost::str(boost::format("Trying to connect a counter set (UID: %1%) to an invalid "
147  "parent category (name: \"%2%\")")
148  % counterSetUidPeek
149  % parentCategoryNameValue));
150  }
151 
152  // Check that the given parent category is already registered
153  auto it = FindCategory(parentCategoryNameValue);
154  if (it == m_Categories.end())
155  {
156  throw InvalidArgumentException(
157  boost::str(boost::format("Trying to connect a counter set (UID: %1%) to a parent category "
158  "that is not registered (name: \"%2%\")")
159  % counterSetUidPeek
160  % parentCategoryNameValue));
161  }
162  }
163 
164  // Get the counter set UID
165  uint16_t counterSetUid = GetNextUid();
166  ARMNN_ASSERT(counterSetUid == counterSetUidPeek);
167 
168  // Create the counter set
169  CounterSetPtr counterSet = std::make_unique<CounterSet>(counterSetUid, counterSetName, count);
170  ARMNN_ASSERT(counterSet);
171 
172  // Get the raw counter set pointer
173  const CounterSet* counterSetPtr = counterSet.get();
174  ARMNN_ASSERT(counterSetPtr);
175 
176  // Register the counter set
177  m_CounterSets.insert(std::make_pair(counterSetUid, std::move(counterSet)));
178 
179  return counterSetPtr;
180 }
std::unique_ptr< CounterSet > CounterSetPtr
uint16_t GetNextUid(bool peekOnly)
bool has_value() const noexcept
Definition: Optional.hpp:53
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
bool IsCounterSetRegistered(uint16_t counterSetUid) const

◆ RegisterDevice()

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

Implements ICounterRegistry.

Definition at line 53 of file CounterDirectory.cpp.

References ARMNN_ASSERT, armnn::profiling::GetNextUid(), OptionalBase::has_value(), CounterDirectory::IsDeviceRegistered(), and OptionalReferenceSwitch< IsReference, T >::value().

Referenced by BOOST_AUTO_TEST_CASE().

56 {
57  // Check that the given device name is valid
58  if (deviceName.empty() ||
59  !IsValidSwTraceString<SwTraceCharPolicy>(deviceName))
60  {
61  throw InvalidArgumentException("Trying to register a device with an invalid name");
62  }
63 
64  // Check that a device with the given name is not already registered
65  if (IsDeviceRegistered(deviceName))
66  {
67  throw InvalidArgumentException(
68  boost::str(boost::format("Trying to register a device already registered (\"%1%\")")
69  % deviceName));
70  }
71 
72  // Check that a category with the given (optional) parent category name is already registered
73  if (parentCategoryName.has_value())
74  {
75  // Get the (optional) parent category name
76  const std::string& parentCategoryNameValue = parentCategoryName.value();
77  if (parentCategoryNameValue.empty())
78  {
79  throw InvalidArgumentException(
80  boost::str(boost::format("Trying to connect a device (name: \"%1%\") to an invalid "
81  "parent category (name: \"%2%\")")
82  % deviceName
83  % parentCategoryNameValue));
84  }
85 
86  // Check that the given parent category is already registered
87  auto categoryIt = FindCategory(parentCategoryNameValue);
88  if (categoryIt == m_Categories.end())
89  {
90  throw InvalidArgumentException(
91  boost::str(boost::format("Trying to connect a device (name: \"%1%\") to a parent category that "
92  "is not registered (name: \"%2%\")")
93  % deviceName
94  % parentCategoryNameValue));
95  }
96  }
97 
98  // Get the device UID
99  uint16_t deviceUid = GetNextUid();
100 
101  // Create the device
102  DevicePtr device = std::make_unique<Device>(deviceUid, deviceName, cores);
103  ARMNN_ASSERT(device);
104 
105  // Get the raw device pointer
106  const Device* devicePtr = device.get();
107  ARMNN_ASSERT(devicePtr);
108 
109  // Register the device
110  m_Devices.insert(std::make_pair(deviceUid, std::move(device)));
111 
112  return devicePtr;
113 }
std::unique_ptr< Device > DevicePtr
bool IsDeviceRegistered(uint16_t deviceUid) const
uint16_t GetNextUid(bool peekOnly)
bool has_value() const noexcept
Definition: Optional.hpp:53
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14

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