aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/test/RequestCountersPacketHandler.hpp
blob: 82bd313b85e6ce8e41376b7f3661fd1170c6f89f (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
//
// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include <armnn/profiling/ILocalPacketHandler.hpp>
#include <armnn/profiling/ProfilingOptions.hpp>
#include "ProfilingUtils.hpp"

#include <common/include/Packet.hpp>

namespace armnn
{

namespace profiling
{

class RequestCountersPacketHandler : public ILocalPacketHandler
{
public:
    explicit RequestCountersPacketHandler(uint32_t capturePeriod = arm::pipe::LOWEST_CAPTURE_PERIOD) :
        m_CapturePeriod(capturePeriod),
        m_Connection(nullptr),
        m_CounterDirectoryMessageHeader(ConstructHeader(0, 2)) {}

    std::vector<uint32_t> GetHeadersAccepted() override; // ILocalPacketHandler

    void HandlePacket(const arm::pipe::Packet& packet) override; // ILocalPacketHandler

    void SetConnection(IInternalProfilingConnection* profilingConnection) override // ILocalPacketHandler
    {
        m_Connection = profilingConnection;
    }

private:
    uint32_t m_CapturePeriod;
    IInternalProfilingConnection* m_Connection;
    uint32_t m_CounterDirectoryMessageHeader;
    std::vector<uint16_t> m_IdList;

    void SendCounterSelectionPacket();
};

} // namespace profiling

} // namespace armnn