1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "Profiling.hpp"
#include "ProfilingEvent.hpp"
namespace armnn
{
Event::Event(const std::string& eventName,
IProfiler* profiler,
Event* parent,
const BackendId backendId,
std::vector<InstrumentPtr>&& instruments,
const Optional<profiling::ProfilingGuid> guid)
: m_EventName(eventName)
, m_Profiler(profiler)
, m_Parent(parent)
, m_BackendId(backendId)
, m_Instruments(std::move(instruments))
, m_ProfilingGuid(guid)
{
}
Event::Event(Event&& other) noexcept
: m_EventName(std::move(other.m_EventName))
, m_Profiler(other.m_Profiler)
, m_Parent(other.m_Parent)
, m_BackendId(other.m_BackendId)
, m_Instruments(std::move(other.m_Instruments))
, m_ProfilingGuid(other.m_ProfilingGuid)
{
}
Event::~Event() noexcept
{
}
void Event::Start()
{
for (auto& instrument : m_Instruments)
{
instrument->Start();
}
}
void Event::Stop()
{
for (auto& instrument : m_Instruments)
{
instrument->Stop();
}
}
const std::vector<Measurement> Event::GetMeasurements() const
{
std::vector<Measurement> measurements;
for (auto& instrument : m_Instruments)
{
for (auto& measurement : instrument->GetMeasurements())
{
measurements.emplace_back(std::move(measurement));
}
}
return measurements;
}
const std::string& Event::GetName() const
{
return m_EventName;
}
const IProfiler* Event::GetProfiler() const
{
return m_Profiler;
}
const Event* Event::GetParentEvent() const
{
return m_Parent;
}
BackendId Event::GetBackendId() const
{
return m_BackendId;
}
Optional<profiling::ProfilingGuid> Event::GetProfilingGuid() const
{
return m_ProfilingGuid;
}
Event& Event::operator=(Event&& other) noexcept
{
if (this == &other)
{
return *this;
}
m_EventName = other.m_EventName;
m_Profiler = other.m_Profiler;
m_Parent = other.m_Parent;
m_BackendId = other.m_BackendId;
m_ProfilingGuid = other.m_ProfilingGuid;
other.m_Profiler = nullptr;
other.m_Parent = nullptr;
return *this;
}
} // namespace armnn
|