blob: 4a28711d6b891cef2f4a193e61d35dd491f7c4c9 (
plain)
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
|
//
// Copyright © 2019 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include "IPeriodicCounterCapture.hpp"
#include "Holder.hpp"
#include "Packet.hpp"
#include "SendCounterPacket.hpp"
#include "ICounterValues.hpp"
#include <WallClockTimer.hpp>
#include <atomic>
#include <chrono>
#include <mutex>
#include <thread>
namespace armnn
{
namespace profiling
{
class PeriodicCounterCapture final : public IPeriodicCounterCapture
{
public:
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 Stop() override;
bool IsRunning() const { return m_IsRunning; }
private:
CaptureData ReadCaptureData();
void Capture(const IReadCounterValues& readCounterValues);
const Holder& m_CaptureDataHolder;
bool m_IsRunning;
std::atomic<bool> m_KeepRunning;
std::thread m_PeriodCaptureThread;
const IReadCounterValues& m_ReadCounterValues;
ISendCounterPacket& m_SendCounterPacket;
};
} // namespace profiling
} // namespace armnn
|