aboutsummaryrefslogtreecommitdiff
path: root/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp
blob: 7d6471bf911ad5feffa7f4d21be1c4d3370449fa (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
//
// Copyright © 2019 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include <Packet.hpp>
#include <CommandHandlerFunctor.hpp>

#include <vector>

namespace armnn
{

namespace gatordmock
{

struct CounterCaptureValues
{
    uint64_t m_Timestamp;
    std::vector<uint16_t> m_Uids;
    std::vector<uint32_t> m_Values;
};

class PeriodicCounterCaptureCommandHandler : public profiling::CommandHandlerFunctor
{

public:
    PeriodicCounterCaptureCommandHandler(uint32_t packetId,
                                         uint32_t version,
                                         bool echoPackets)
        : CommandHandlerFunctor(packetId, version)
        , m_EchoPackets(echoPackets)
    {}

    void operator()(const armnn::profiling::Packet& packet) override;

    CounterCaptureValues m_CounterCaptureValues;

    uint64_t m_CurrentPeriodValue = 0;

private:
    void ParseData(const armnn::profiling::Packet& packet);

    uint64_t m_FirstTimestamp = 0, m_SecondTimestamp = 0;

    bool m_HeaderPrinted = false;
    bool m_EchoPackets;
};

} // namespace gatordmock

} // namespace armnn