aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/ProfilingEvent.hpp
diff options
context:
space:
mode:
authortelsoa01 <telmo.soares@arm.com>2018-08-31 09:22:23 +0100
committertelsoa01 <telmo.soares@arm.com>2018-08-31 09:22:23 +0100
commitc577f2c6a3b4ddb6ba87a882723c53a248afbeba (patch)
treebd7d4c148df27f8be6649d313efb24f536b7cf34 /src/armnn/ProfilingEvent.hpp
parent4c7098bfeab1ffe1cdc77f6c15548d3e73274746 (diff)
downloadarmnn-c577f2c6a3b4ddb6ba87a882723c53a248afbeba.tar.gz
Release 18.08
Diffstat (limited to 'src/armnn/ProfilingEvent.hpp')
-rw-r--r--src/armnn/ProfilingEvent.hpp92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/armnn/ProfilingEvent.hpp b/src/armnn/ProfilingEvent.hpp
new file mode 100644
index 0000000000..61a2ee99e3
--- /dev/null
+++ b/src/armnn/ProfilingEvent.hpp
@@ -0,0 +1,92 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// See LICENSE file in the project root for full license information.
+//
+
+#pragma once
+
+#include <stack>
+#include <vector>
+#include <chrono>
+#include <memory>
+#include "Instrument.hpp"
+#include "armnn/Types.hpp"
+
+namespace armnn
+{
+
+/// Forward declaration
+class Profiler;
+
+/// Event class records measurements reported by BeginEvent()/EndEvent() and returns measurements when
+/// Event::GetMeasurements() is called.
+class Event
+{
+public:
+ using InstrumentPtr = std::unique_ptr<Instrument>;
+ using Instruments = std::vector<InstrumentPtr>;
+
+ Event(const std::string& eventName,
+ Profiler* profiler,
+ Event* parent,
+ const Compute computeDevice,
+ std::vector<InstrumentPtr>&& instrument);
+
+ Event(const Event& other) = delete;
+
+ /// Move Constructor
+ Event(Event&& other) noexcept;
+
+ /// Destructor
+ ~Event() noexcept;
+
+ /// Start the Event
+ void Start();
+
+ /// Stop the Event
+ void Stop();
+
+ /// Get the recorded measurements calculated between Start() and Stop()
+ /// \return Recorded measurements of the event
+ const std::vector<Measurement> GetMeasurements() const;
+
+ /// Get the name of the event
+ /// \return Name of the event
+ const std::string& GetName() const;
+
+ /// Get the pointer of the profiler associated with this event
+ /// \return Pointer of the profiler associated with this event
+ const Profiler* GetProfiler() const;
+
+ /// Get the pointer of the parent event
+ /// \return Pointer of the parent event
+ const Event* GetParentEvent() const;
+
+ /// Get the compute device of the event
+ /// \return Compute device of the event
+ Compute GetComputeDevice() const;
+
+ /// Assignment operator
+ Event& operator=(const Event& other) = delete;
+
+ /// Move Assignment operator
+ Event& operator=(Event&& other) noexcept;
+
+private:
+ /// Name of the event
+ std::string m_EventName;
+
+ /// Stored associated profiler
+ Profiler* m_Profiler;
+
+ /// Stores optional parent event
+ Event* m_Parent;
+
+ /// Compute device
+ Compute m_ComputeDevice;
+
+ /// Instruments to use
+ Instruments m_Instruments;
+};
+
+} // namespace armnn