ArmNN
 24.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, 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::vector< InstrumentPtr > & GetInstruments () const
 Get the Instruments used by this Event. 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 89 of file ProfilingEvent.cpp.

90 {
91  return m_BackendId;
92 }

Referenced by ProfilerImpl::AnalyzeEventSequenceAndWriteResults().

◆ GetInstruments()

const std::vector< Event::InstrumentPtr > & GetInstruments ( ) const

Get the Instruments used by this Event.

Returns
Return a reference to the collection of Instruments

Definition at line 69 of file ProfilingEvent.cpp.

70 {
71  return m_Instruments;
72 }

Referenced by armnn::ExtractJsonObjects().

◆ 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.

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 }

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

◆ GetName()

const std::string & GetName ( ) const

Get the name of the event.

Returns
Name of the event

Definition at line 74 of file ProfilingEvent.cpp.

75 {
76  return m_EventName;
77 }

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

◆ GetParentEvent()

const Event * GetParentEvent ( ) const

Get the pointer of the parent event.

Returns
Pointer of the parent event

Definition at line 84 of file ProfilingEvent.cpp.

85 {
86  return m_Parent;
87 }

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

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

80 {
81  return m_Profiler;
82 }

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

95 {
96  return m_ProfilingGuid;
97 }

Referenced by armnn::ExtractJsonObjects().

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

101 {
102  if (this == &other)
103  {
104  return *this;
105  }
106 
107  m_EventName = other.m_EventName;
108  m_Profiler = other.m_Profiler;
109  m_Parent = other.m_Parent;
110  m_BackendId = other.m_BackendId;
111  m_ProfilingGuid = other.m_ProfilingGuid;
112  other.m_Profiler = nullptr;
113  other.m_Parent = nullptr;
114  return *this;
115 }

◆ Start()

void Start ( )

Start the Event.

Definition at line 40 of file ProfilingEvent.cpp.

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.

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

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