ArmNN
 24.02
NeonTimer Class Reference

#include <NeonTimer.hpp>

Inheritance diagram for NeonTimer:
[legend]
Collaboration diagram for NeonTimer:
[legend]

Public Types

using KernelMeasurements = std::vector< Measurement >
 

Public Member Functions

 NeonTimer ()=default
 
 ~NeonTimer ()=default
 
void Start () override
 
void Stop () override
 
bool HasKernelMeasurements () const override
 
std::vector< MeasurementGetMeasurements () const override
 
const char * GetName () const override
 
- Public Member Functions inherited from Instrument
virtual ~Instrument ()
 

Detailed Description

Definition at line 21 of file NeonTimer.hpp.

Member Typedef Documentation

◆ KernelMeasurements

using KernelMeasurements = std::vector<Measurement>

Definition at line 24 of file NeonTimer.hpp.

Constructor & Destructor Documentation

◆ NeonTimer()

NeonTimer ( )
default

◆ ~NeonTimer()

~NeonTimer ( )
default

Member Function Documentation

◆ GetMeasurements()

std::vector< Measurement > GetMeasurements ( ) const
overridevirtual

Implements Instrument.

Definition at line 50 of file NeonTimer.cpp.

51 {
52  std::vector<Measurement> measurements = m_Kernels;
53  unsigned int kernel_number = 0;
54  for (auto & kernel : measurements)
55  {
56  std::string kernelName = std::string(this->GetName()) + "/" + std::to_string(kernel_number++) + ": " + kernel
57  .m_Name;
58  kernel.m_Name = kernelName;
59  }
60  return measurements;
61 }

References NeonTimer::GetName().

◆ GetName()

const char * GetName ( ) const
overridevirtual

Implements Instrument.

Definition at line 63 of file NeonTimer.cpp.

64 {
65  return "NeonKernelTimer";
66 }

Referenced by NeonTimer::GetMeasurements().

◆ HasKernelMeasurements()

bool HasKernelMeasurements ( ) const
overridevirtual

Reimplemented from Instrument.

Definition at line 45 of file NeonTimer.cpp.

46 {
47  return m_Kernels.size() > 0;
48 }

◆ Start()

void Start ( )
overridevirtual

Implements Instrument.

Definition at line 21 of file NeonTimer.cpp.

22 {
23  m_Kernels.clear();
24  ARMNN_ASSERT(g_Interceptor->GetKernels() == nullptr);
25  g_Interceptor->SetKernels(&m_Kernels);
26 
27  m_RealSchedulerType = arm_compute::Scheduler::get_type();
28  //Note: We can't currently replace a custom scheduler
29  if(m_RealSchedulerType != arm_compute::Scheduler::Type::CUSTOM)
30  {
31  // Keep the real schedule and add NeonInterceptorScheduler as an interceptor
32  m_RealScheduler = &arm_compute::Scheduler::get();
33  arm_compute::Scheduler::set(armnn::PolymorphicPointerDowncast<arm_compute::IScheduler>(g_Interceptor));
34  }
35 }

References ARMNN_ASSERT.

◆ Stop()

void Stop ( )
overridevirtual

Implements Instrument.

Definition at line 37 of file NeonTimer.cpp.

38 {
39  // Restore real scheduler
40  g_Interceptor->SetKernels(nullptr);
41  arm_compute::Scheduler::set(m_RealSchedulerType);
42  m_RealScheduler = nullptr;
43 }

The documentation for this class was generated from the following files:
ARMNN_ASSERT
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
armnn::NeonTimer::GetName
const char * GetName() const override
Definition: NeonTimer.cpp:63