ArmNN
 20.02
Event Class Reference

Event class records measurements reported by BeginEvent()/EndEvent() and returns measurements when Event::GetMeasurements() is called. More...

#include <ProfilingEvent.hpp>

Public Types

using InstrumentPtr = std::unique_ptr< Instrument >
 
using Instruments = std::vector< InstrumentPtr >
 

Public Member Functions

 Event (const std::string &eventName, Profiler *profiler, Event *parent, const BackendId backendId, std::vector< InstrumentPtr > &&instrument)
 
 Event (const Event &other)=delete
 
 Event (Event &&other) noexcept
 Move Constructor. More...
 
 ~Event () noexcept
 Destructor. More...
 
void Start ()
 Start the Event. More...
 
void Stop ()
 Stop the Event. More...
 
const std::vector< MeasurementGetMeasurements () const
 Get the recorded measurements calculated between Start() and Stop() More...
 
const std::string & GetName () const
 Get the name of the event. More...
 
const ProfilerGetProfiler () const
 Get the pointer of the profiler associated with this event. More...
 
const EventGetParentEvent () const
 Get the pointer of the parent event. More...
 
BackendId GetBackendId () const
 Get the backend id of the event. More...
 
Eventoperator= (const Event &other)=delete
 Assignment operator. More...
 
Eventoperator= (Event &&other) noexcept
 Move Assignment operator. More...
 

Detailed Description

Event class records measurements reported by BeginEvent()/EndEvent() and returns measurements when Event::GetMeasurements() is called.

Definition at line 23 of file ProfilingEvent.hpp.

Member Typedef Documentation

◆ InstrumentPtr

using InstrumentPtr = std::unique_ptr<Instrument>

Definition at line 26 of file ProfilingEvent.hpp.

◆ Instruments

using Instruments = std::vector<InstrumentPtr>

Definition at line 27 of file ProfilingEvent.hpp.

Constructor & Destructor Documentation

◆ Event() [1/3]

Event ( const std::string &  eventName,
Profiler profiler,
Event parent,
const BackendId  backendId,
std::vector< InstrumentPtr > &&  instrument 
)

Definition at line 11 of file ProfilingEvent.cpp.

16  : m_EventName(eventName)
17  , m_Profiler(profiler)
18  , m_Parent(parent)
19  , m_BackendId(backendId)
20  , m_Instruments(std::move(instruments))
21 {
22 }

◆ Event() [2/3]

Event ( const Event other)
delete

◆ Event() [3/3]

Event ( Event &&  other)
noexcept

Move Constructor.

Definition at line 24 of file ProfilingEvent.cpp.

25  : m_EventName(std::move(other.m_EventName))
26  , m_Profiler(other.m_Profiler)
27  , m_Parent(other.m_Parent)
28  , m_BackendId(other.m_BackendId)
29  , m_Instruments(std::move(other.m_Instruments))
30 
31 {
32 }

◆ ~Event()

~Event ( )
noexcept

Destructor.

Definition at line 34 of file ProfilingEvent.cpp.

35 {
36 }

Member Function Documentation

◆ GetBackendId()

BackendId GetBackendId ( ) const

Get the backend id of the event.

Returns
Backend id of the event

Definition at line 82 of file ProfilingEvent.cpp.

Referenced by Profiler::AnalyzeEventSequenceAndWriteResults().

83 {
84  return m_BackendId;
85 }

◆ GetMeasurements()

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

Get the recorded measurements calculated between Start() and Stop()

Returns
Recorded measurements of the event

Definition at line 54 of file ProfilingEvent.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), armnn::ExtractJsonObjects(), armnn::FindKernelMeasurements(), and armnn::FindMeasurement().

55 {
56  std::vector<Measurement> measurements;
57  for (auto& instrument : m_Instruments)
58  {
59  for (auto& measurement : instrument->GetMeasurements())
60  {
61  measurements.emplace_back(std::move(measurement));
62  }
63  }
64  return measurements;
65 }

◆ GetName()

const std::string & GetName ( ) const

Get the name of the event.

Returns
Name of the event

Definition at line 67 of file ProfilingEvent.cpp.

Referenced by Profiler::AnalyzeEventSequenceAndWriteResults(), BOOST_AUTO_TEST_CASE(), and armnn::CalcLevel().

68 {
69  return m_EventName;
70 }

◆ GetParentEvent()

const Event * GetParentEvent ( ) const

Get the pointer of the parent event.

Returns
Pointer of the parent event

Definition at line 77 of file ProfilingEvent.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), armnn::CalcLevel(), and Profiler::EndEvent().

78 {
79  return m_Parent;
80 }

◆ GetProfiler()

const Profiler * GetProfiler ( ) const

Get the pointer of the profiler associated with this event.

Returns
Pointer of the profiler associated with this event

Definition at line 72 of file ProfilingEvent.cpp.

73 {
74  return m_Profiler;
75 }

◆ operator=() [1/2]

Event& operator= ( const Event other)
delete

Assignment operator.

◆ operator=() [2/2]

Event & operator= ( Event &&  other)
noexcept

Move Assignment operator.

Definition at line 87 of file ProfilingEvent.cpp.

88 {
89  if (this == &other)
90  {
91  return *this;
92  }
93 
94  m_EventName = other.m_EventName;
95  m_Profiler = other.m_Profiler;
96  m_Parent = other.m_Parent;
97  m_BackendId = other.m_BackendId;
98  other.m_Profiler = nullptr;
99  other.m_Parent = nullptr;
100  return *this;
101 }

◆ Start()

void Start ( )

Start the Event.

Definition at line 38 of file ProfilingEvent.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

39 {
40  for (auto& instrument : m_Instruments)
41  {
42  instrument->Start();
43  }
44 }

◆ Stop()

void Stop ( )

Stop the Event.

Definition at line 46 of file ProfilingEvent.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

47 {
48  for (auto& instrument : m_Instruments)
49  {
50  instrument->Stop();
51  }
52 }

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