ArmNN
 22.05
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, IProfiler *profiler, Event *parent, const BackendId backendId, std::vector< InstrumentPtr > &&instrument, const Optional< arm::pipe::ProfilingGuid > guid)
 
 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 IProfilerGetProfiler () 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...
 
Optional< arm::pipe::ProfilingGuid > GetProfilingGuid () const
 Get the associated profiling GUID if the event is a workload. 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 27 of file ProfilingEvent.hpp.

Member Typedef Documentation

◆ InstrumentPtr

using InstrumentPtr = std::unique_ptr<Instrument>

Definition at line 30 of file ProfilingEvent.hpp.

◆ Instruments

using Instruments = std::vector<InstrumentPtr>

Definition at line 31 of file ProfilingEvent.hpp.

Constructor & Destructor Documentation

◆ Event() [1/3]

Event ( const std::string &  eventName,
IProfiler profiler,
Event parent,
const BackendId  backendId,
std::vector< InstrumentPtr > &&  instrument,
const Optional< arm::pipe::ProfilingGuid >  guid 
)

Definition at line 11 of file ProfilingEvent.cpp.

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

◆ Event() [2/3]

Event ( const Event other)
delete

◆ Event() [3/3]

Event ( Event &&  other)
noexcept

Move Constructor.

Definition at line 26 of file ProfilingEvent.cpp.

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

◆ ~Event()

~Event ( )
noexcept

Destructor.

Definition at line 36 of file ProfilingEvent.cpp.

37 {
38 }

Member Function Documentation

◆ GetBackendId()

BackendId GetBackendId ( ) const

Get the backend id of the event.

Returns
Backend id of the event

Definition at line 84 of file ProfilingEvent.cpp.

Referenced by ProfilerImpl::AnalyzeEventSequenceAndWriteResults().

85 {
86  return m_BackendId;
87 }

◆ 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 56 of file ProfilingEvent.cpp.

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

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

◆ GetName()

const std::string & GetName ( ) const

Get the name of the event.

Returns
Name of the event

Definition at line 69 of file ProfilingEvent.cpp.

Referenced by ProfilerImpl::AnalyzeEventSequenceAndWriteResults(), ProfilerImpl::PopulateParent(), and TEST_SUITE().

70 {
71  return m_EventName;
72 }

◆ GetParentEvent()

const Event * GetParentEvent ( ) const

Get the pointer of the parent event.

Returns
Pointer of the parent event

Definition at line 79 of file ProfilingEvent.cpp.

Referenced by armnn::CalcLevel(), ProfilerImpl::EndEvent(), ProfilerImpl::PopulateDescendants(), and TEST_SUITE().

80 {
81  return m_Parent;
82 }

◆ GetProfiler()

const IProfiler * GetProfiler ( ) const

Get the pointer of the profiler associated with this event.

Returns
Pointer of the profiler associated with this event

Definition at line 74 of file ProfilingEvent.cpp.

75 {
76  return m_Profiler;
77 }

◆ GetProfilingGuid()

Optional< arm::pipe::ProfilingGuid > GetProfilingGuid ( ) const

Get the associated profiling GUID if the event is a workload.

Returns
Optional GUID of the event

Definition at line 89 of file ProfilingEvent.cpp.

Referenced by armnn::ExtractJsonObjects().

90 {
91  return m_ProfilingGuid;
92 }

◆ 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 95 of file ProfilingEvent.cpp.

96 {
97  if (this == &other)
98  {
99  return *this;
100  }
101 
102  m_EventName = other.m_EventName;
103  m_Profiler = other.m_Profiler;
104  m_Parent = other.m_Parent;
105  m_BackendId = other.m_BackendId;
106  m_ProfilingGuid = other.m_ProfilingGuid;
107  other.m_Profiler = nullptr;
108  other.m_Parent = nullptr;
109  return *this;
110 }

◆ Start()

void Start ( )

Start the Event.

Definition at line 40 of file ProfilingEvent.cpp.

Referenced by TEST_SUITE().

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

◆ Stop()

void Stop ( )

Stop the Event.

Definition at line 48 of file ProfilingEvent.cpp.

Referenced by TEST_SUITE().

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

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