diff options
author | telsoa01 <telmo.soares@arm.com> | 2018-08-31 09:22:23 +0100 |
---|---|---|
committer | telsoa01 <telmo.soares@arm.com> | 2018-08-31 09:22:23 +0100 |
commit | c577f2c6a3b4ddb6ba87a882723c53a248afbeba (patch) | |
tree | bd7d4c148df27f8be6649d313efb24f536b7cf34 /src/armnn/ProfilingEvent.cpp | |
parent | 4c7098bfeab1ffe1cdc77f6c15548d3e73274746 (diff) | |
download | armnn-c577f2c6a3b4ddb6ba87a882723c53a248afbeba.tar.gz |
Release 18.08
Diffstat (limited to 'src/armnn/ProfilingEvent.cpp')
-rw-r--r-- | src/armnn/ProfilingEvent.cpp | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/armnn/ProfilingEvent.cpp b/src/armnn/ProfilingEvent.cpp new file mode 100644 index 0000000000..42a44a7280 --- /dev/null +++ b/src/armnn/ProfilingEvent.cpp @@ -0,0 +1,103 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#include "Profiling.hpp" +#include "ProfilingEvent.hpp" + +namespace armnn +{ +Event::Event(const std::string& eventName, + Profiler* profiler, + Event* parent, + const Compute computeDevice, + std::vector<InstrumentPtr>&& instruments) + : m_EventName(eventName) + , m_Profiler(profiler) + , m_Parent(parent) + , m_ComputeDevice(computeDevice) + , m_Instruments(std::move(instruments)) +{ +} + +Event::Event(Event&& other) noexcept + : m_EventName(std::move(other.m_EventName)) + , m_Profiler(other.m_Profiler) + , m_Parent(other.m_Parent) + , m_ComputeDevice(other.m_ComputeDevice) + , m_Instruments(std::move(other.m_Instruments)) + +{ +} + +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 Profiler* Event::GetProfiler() const +{ + return m_Profiler; +} + +const Event* Event::GetParentEvent() const +{ + return m_Parent; +} + +Compute Event::GetComputeDevice() const +{ + return m_ComputeDevice; +} + +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_ComputeDevice = other.m_ComputeDevice; + other.m_Profiler = nullptr; + other.m_Parent = nullptr; + return *this; +} + +} // namespace armnn |