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 --- ...n_1_1profiling_1_1_mock_counter_directory.xhtml | 837 +++++++++++++++++++++ 1 file changed, 837 insertions(+) create mode 100644 20.02/classarmnn_1_1profiling_1_1_mock_counter_directory.xhtml (limited to '20.02/classarmnn_1_1profiling_1_1_mock_counter_directory.xhtml') diff --git a/20.02/classarmnn_1_1profiling_1_1_mock_counter_directory.xhtml b/20.02/classarmnn_1_1profiling_1_1_mock_counter_directory.xhtml new file mode 100644 index 0000000000..165c397162 --- /dev/null +++ b/20.02/classarmnn_1_1profiling_1_1_mock_counter_directory.xhtml @@ -0,0 +1,837 @@ + + + + + + + + + + + + + +ArmNN: MockCounterDirectory Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
MockCounterDirectory Class Reference
+
+
+ +

#include <ProfilingMocks.hpp>

+
+Inheritance diagram for MockCounterDirectory:
+
+
+ + +ICounterDirectory + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 MockCounterDirectory ()=default
 
 ~MockCounterDirectory ()=default
 
const CategoryRegisterCategory (const std::string &categoryName)
 
const DeviceRegisterDevice (const std::string &deviceName, uint16_t cores=0)
 
const CounterSetRegisterCounterSet (const std::string &counterSetName, uint16_t count=0)
 
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 armnn::Optional< std::string > &units=armnn::EmptyOptional(), const armnn::Optional< uint16_t > &numberOfCores=armnn::EmptyOptional(), const armnn::Optional< uint16_t > &deviceUid=armnn::EmptyOptional(), const armnn::Optional< uint16_t > &counterSetUid=armnn::EmptyOptional())
 
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
 
- Public Member Functions inherited from ICounterDirectory
virtual ~ICounterDirectory ()
 
+

Detailed Description

+
+

Definition at line 439 of file ProfilingMocks.hpp.

+

Constructor & Destructor Documentation

+ +

◆ MockCounterDirectory()

+ +
+
+ + + + + +
+ + + + + + + +
MockCounterDirectory ()
+
+default
+
+ +
+
+ +

◆ ~MockCounterDirectory()

+ +
+
+ + + + + +
+ + + + + + + +
~MockCounterDirectory ()
+
+default
+
+ +
+
+

Member Function Documentation

+ +

◆ GetCategories()

+ +
+
+ + + + + +
+ + + + + + + +
const Categories& GetCategories () const
+
+inlineoverridevirtual
+
+ +

Implements ICounterDirectory.

+ +

Definition at line 575 of file ProfilingMocks.hpp.

+
575 { return m_Categories; }
+
+
+ +

◆ GetCategory()

+ +
+
+ + + + + +
+ + + + + + + + +
const Category* GetCategory (const std::string & name) const
+
+inlineoverridevirtual
+
+ +

Implements ICounterDirectory.

+ +

Definition at line 581 of file ProfilingMocks.hpp.

+
582  {
583  auto it = std::find_if(m_Categories.begin(), m_Categories.end(), [&name](const CategoryPtr& category)
584  {
585  BOOST_ASSERT(category);
586 
587  return category->m_Name == name;
588  });
589 
590  if (it == m_Categories.end())
591  {
592  return nullptr;
593  }
594 
595  return it->get();
596  }
std::unique_ptr< Category > CategoryPtr
+
+
+
+ +

◆ GetCategoryCount()

+ +
+
+ + + + + +
+ + + + + + + +
uint16_t GetCategoryCount () const
+
+inlineoverridevirtual
+
+ +

Implements ICounterDirectory.

+ +

Definition at line 569 of file ProfilingMocks.hpp.

+ +

References armnn::numeric_cast().

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
569 { 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
+
+inlineoverridevirtual
+
+ +

Implements ICounterDirectory.

+ +

Definition at line 610 of file ProfilingMocks.hpp.

+ +

References armnn::IgnoreUnused().

+
611  {
612  IgnoreUnused(uid);
613  return nullptr; // Not used by the unit tests
614  }
void IgnoreUnused(Ts &&...)
+
+
+
+ +

◆ GetCounterCount()

+ +
+
+ + + + + +
+ + + + + + + +
uint16_t GetCounterCount () const
+
+inlineoverridevirtual
+
+ +

Implements ICounterDirectory.

+ +

Definition at line 572 of file ProfilingMocks.hpp.

+ +

References armnn::numeric_cast().

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
572 { 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()

+ +
+
+ + + + + +
+ + + + + + + +
const Counters& GetCounters () const
+
+inlineoverridevirtual
+
+ +

Implements ICounterDirectory.

+ +

Definition at line 578 of file ProfilingMocks.hpp.

+
578 { return m_Counters; }
+
+
+ +

◆ GetCounterSet()

+ +
+
+ + + + + +
+ + + + + + + + +
const CounterSet* GetCounterSet (uint16_t uid) const
+
+inlineoverridevirtual
+
+ +

Implements ICounterDirectory.

+ +

Definition at line 604 of file ProfilingMocks.hpp.

+ +

References armnn::IgnoreUnused().

+
605  {
606  IgnoreUnused(uid);
607  return nullptr; // Not used by the unit tests
608  }
void IgnoreUnused(Ts &&...)
+
+
+
+ +

◆ GetCounterSetCount()

+ +
+
+ + + + + +
+ + + + + + + +
uint16_t GetCounterSetCount () const
+
+inlineoverridevirtual
+
+ +

Implements ICounterDirectory.

+ +

Definition at line 571 of file ProfilingMocks.hpp.

+ +

References armnn::numeric_cast().

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
571 { 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 577 of file ProfilingMocks.hpp.

+
577 { return m_CounterSets; }
+
+
+ +

◆ GetDevice()

+ +
+
+ + + + + +
+ + + + + + + + +
const Device* GetDevice (uint16_t uid) const
+
+inlineoverridevirtual
+
+ +

Implements ICounterDirectory.

+ +

Definition at line 598 of file ProfilingMocks.hpp.

+ +

References armnn::IgnoreUnused().

+
599  {
600  IgnoreUnused(uid);
601  return nullptr; // Not used by the unit tests
602  }
void IgnoreUnused(Ts &&...)
+
+
+
+ +

◆ GetDeviceCount()

+ +
+
+ + + + + +
+ + + + + + + +
uint16_t GetDeviceCount () const
+
+inlineoverridevirtual
+
+ +

Implements ICounterDirectory.

+ +

Definition at line 570 of file ProfilingMocks.hpp.

+ +

References armnn::numeric_cast().

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
570 { 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 576 of file ProfilingMocks.hpp.

+
576 { return m_Devices; }
+
+
+ +

◆ RegisterCategory()

+ +
+
+ + + + + +
+ + + + + + + + +
const Category* RegisterCategory (const std::string & categoryName)
+
+inline
+
+ +

Definition at line 446 of file ProfilingMocks.hpp.

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
447  {
448  // Create the category
449  CategoryPtr category = std::make_unique<Category>(categoryName);
450  BOOST_ASSERT(category);
451 
452  // Get the raw category pointer
453  const Category* categoryPtr = category.get();
454  BOOST_ASSERT(categoryPtr);
455 
456  // Register the category
457  m_Categories.insert(std::move(category));
458 
459  return categoryPtr;
460  }
std::unique_ptr< Category > CategoryPtr
+
+
+
+ +

◆ RegisterCounter()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
const Counter* RegisterCounter (const BackendIdbackendId,
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 armnn::Optional< std::string > & units = armnn::EmptyOptional(),
const armnn::Optional< uint16_t > & numberOfCores = armnn::EmptyOptional(),
const armnn::Optional< uint16_t > & deviceUid = armnn::EmptyOptional(),
const armnn::Optional< uint16_t > & counterSetUid = armnn::EmptyOptional() 
)
+
+inline
+
+ +

Definition at line 503 of file ProfilingMocks.hpp.

+ +

References armnn::profiling::GetNextCounterUids(), armnn::IgnoreUnused(), and Category::m_Counters.

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
515  {
516  IgnoreUnused(backendId);
517 
518  // Get the number of cores from the argument only
519  uint16_t deviceCores = numberOfCores.has_value() ? numberOfCores.value() : 0;
520 
521  // Get the device UID
522  uint16_t deviceUidValue = deviceUid.has_value() ? deviceUid.value() : 0;
523 
524  // Get the counter set UID
525  uint16_t counterSetUidValue = counterSetUid.has_value() ? counterSetUid.value() : 0;
526 
527  // Get the counter UIDs and calculate the max counter UID
528  std::vector<uint16_t> counterUids = GetNextCounterUids(uid, deviceCores);
529  BOOST_ASSERT(!counterUids.empty());
530  uint16_t maxCounterUid = deviceCores <= 1 ? counterUids.front() : counterUids.back();
531 
532  // Get the counter units
533  const std::string unitsValue = units.has_value() ? units.value() : "";
534 
535  // Create the counter
536  CounterPtr counter = std::make_shared<Counter>(armnn::profiling::BACKEND_ID,
537  counterUids.front(),
538  maxCounterUid,
539  counterClass,
540  interpolation,
541  multiplier,
542  name,
543  description,
544  unitsValue,
545  deviceUidValue,
546  counterSetUidValue);
547  BOOST_ASSERT(counter);
548 
549  // Get the raw counter pointer
550  const Counter* counterPtr = counter.get();
551  BOOST_ASSERT(counterPtr);
552 
553  // Process multiple counters if necessary
554  for (uint16_t counterUid : counterUids)
555  {
556  // Connect the counter to the parent category
557  Category* parentCategory = const_cast<Category*>(GetCategory(parentCategoryName));
558  BOOST_ASSERT(parentCategory);
559  parentCategory->m_Counters.push_back(counterUid);
560 
561  // Register the counter
562  m_Counters.insert(std::make_pair(counterUid, counter));
563  }
564 
565  return counterPtr;
566  }
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)
+
const Category * GetCategory(const std::string &name) const override
+
+
+
+ +

◆ RegisterCounterSet()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
const CounterSet* RegisterCounterSet (const std::string & counterSetName,
uint16_t count = 0 
)
+
+inline
+
+ +

Definition at line 482 of file ProfilingMocks.hpp.

+ +

References armnn::profiling::GetNextUid().

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
485  {
486  // Get the counter set UID
487  uint16_t counterSetUid = GetNextUid();
488 
489  // Create the counter set
490  CounterSetPtr counterSet = std::make_unique<CounterSet>(counterSetUid, counterSetName, count);
491  BOOST_ASSERT(counterSet);
492 
493  // Get the raw counter set pointer
494  const CounterSet* counterSetPtr = counterSet.get();
495  BOOST_ASSERT(counterSetPtr);
496 
497  // Register the counter set
498  m_CounterSets.insert(std::make_pair(counterSetUid, std::move(counterSet)));
499 
500  return counterSetPtr;
501  }
std::unique_ptr< CounterSet > CounterSetPtr
+
uint16_t GetNextUid(bool peekOnly)
+
+
+
+ +

◆ RegisterDevice()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
const Device* RegisterDevice (const std::string & deviceName,
uint16_t cores = 0 
)
+
+inline
+
+ +

Definition at line 462 of file ProfilingMocks.hpp.

+ +

References armnn::profiling::GetNextUid().

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
464  {
465  // Get the device UID
466  uint16_t deviceUid = GetNextUid();
467 
468  // Create the device
469  DevicePtr device = std::make_unique<Device>(deviceUid, deviceName, cores);
470  BOOST_ASSERT(device);
471 
472  // Get the raw device pointer
473  const Device* devicePtr = device.get();
474  BOOST_ASSERT(devicePtr);
475 
476  // Register the device
477  m_Devices.insert(std::make_pair(deviceUid, std::move(device)));
478 
479  return devicePtr;
480  }
std::unique_ptr< Device > DevicePtr
+
uint16_t GetNextUid(bool peekOnly)
+
+
+
+
The documentation for this class was generated from the following file: +
+
+ + + + -- cgit v1.2.1