Francis Murtagh | fcb8ef6 | 2019-09-20 15:40:09 +0100 | [diff] [blame^] | 1 | // |
| 2 | // Copyright © 2019 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include "Holder.hpp" |
| 9 | #include "IPeriodicCounterCapture.hpp" |
| 10 | #include "Packet.hpp" |
| 11 | #include "IReadCounterValue.hpp" |
| 12 | #include "SendCounterPacket.hpp" |
| 13 | |
| 14 | #include "WallClockTimer.hpp" |
| 15 | |
| 16 | #include <atomic> |
| 17 | #include <chrono> |
| 18 | #include <mutex> |
| 19 | #include <thread> |
| 20 | |
| 21 | namespace armnn |
| 22 | { |
| 23 | |
| 24 | namespace profiling |
| 25 | { |
| 26 | |
| 27 | class PeriodicCounterCapture final : public IPeriodicCounterCapture |
| 28 | { |
| 29 | public: |
| 30 | PeriodicCounterCapture(const Holder& data, ISendCounterPacket& packet, const IReadCounterValue& readCounterValue); |
| 31 | |
| 32 | void Start() override; |
| 33 | void Join(); |
| 34 | |
| 35 | private: |
| 36 | CaptureData ReadCaptureData(); |
| 37 | void Functionality(const IReadCounterValue& readCounterValue); |
| 38 | |
| 39 | const Holder& m_CaptureDataHolder; |
| 40 | std::atomic<bool> m_IsRunning; |
| 41 | std::thread m_PeriodCaptureThread; |
| 42 | const IReadCounterValue& m_ReadCounterValue; |
| 43 | ISendCounterPacket& m_SendCounterPacket; |
| 44 | }; |
| 45 | |
| 46 | } // namespace profiling |
| 47 | |
| 48 | } // namespace armnn |