aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/PeriodicCounterCapture.hpp
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-10-04 17:17:42 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-07 10:08:58 +0000
commite0e6efc1072358b843f47d2ffffc3d873a4889c6 (patch)
treef328699a6cbce13f0b64d74692ee92be2a22477a /src/profiling/PeriodicCounterCapture.hpp
parent8a837179ad883e9b5dd982a25cc5e94f245f79ed (diff)
downloadarmnn-e0e6efc1072358b843f47d2ffffc3d873a4889c6.tar.gz
IVGCVSW-3937 Refactor and improve the PeriodicCounterCapture class
* Conformed the PeriodicCounterCapture class to the other thread-based classes * Code refactoring * Renamed CounterValues file to ICounterValues * Removed no longer used file * Updated unit tests accordingly Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com> Change-Id: I8c42aa17e17a90cda5cf86eb8ac2d13501ecdadc
Diffstat (limited to 'src/profiling/PeriodicCounterCapture.hpp')
-rw-r--r--src/profiling/PeriodicCounterCapture.hpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/profiling/PeriodicCounterCapture.hpp b/src/profiling/PeriodicCounterCapture.hpp
index 8a7ff37bf9..2e9ac364f1 100644
--- a/src/profiling/PeriodicCounterCapture.hpp
+++ b/src/profiling/PeriodicCounterCapture.hpp
@@ -5,13 +5,13 @@
#pragma once
-#include "Holder.hpp"
#include "IPeriodicCounterCapture.hpp"
+#include "Holder.hpp"
#include "Packet.hpp"
-#include "IReadCounterValue.hpp"
#include "SendCounterPacket.hpp"
+#include "ICounterValues.hpp"
-#include "WallClockTimer.hpp"
+#include <WallClockTimer.hpp>
#include <atomic>
#include <chrono>
@@ -27,20 +27,29 @@ namespace profiling
class PeriodicCounterCapture final : public IPeriodicCounterCapture
{
public:
- PeriodicCounterCapture(const Holder& data, ISendCounterPacket& packet, const IReadCounterValue& readCounterValue);
+ PeriodicCounterCapture(const Holder& data, ISendCounterPacket& packet, const IReadCounterValues& readCounterValue)
+ : m_CaptureDataHolder(data)
+ , m_IsRunning(false)
+ , m_KeepRunning(false)
+ , m_ReadCounterValues(readCounterValue)
+ , m_SendCounterPacket(packet)
+ {}
+ ~PeriodicCounterCapture() { Stop(); }
void Start() override;
- void Join();
+ void Stop() override;
+ bool IsRunning() const { return m_IsRunning.load(); }
private:
CaptureData ReadCaptureData();
- void Functionality(const IReadCounterValue& readCounterValue);
-
- const Holder& m_CaptureDataHolder;
- std::atomic<bool> m_IsRunning;
- std::thread m_PeriodCaptureThread;
- const IReadCounterValue& m_ReadCounterValue;
- ISendCounterPacket& m_SendCounterPacket;
+ void Capture(const IReadCounterValues& readCounterValues);
+
+ const Holder& m_CaptureDataHolder;
+ std::atomic<bool> m_IsRunning;
+ std::atomic<bool> m_KeepRunning;
+ std::thread m_PeriodCaptureThread;
+ const IReadCounterValues& m_ReadCounterValues;
+ ISendCounterPacket& m_SendCounterPacket;
};
} // namespace profiling