blob: 7068a4f253b6eb21b33462e1ae1b68ed894d3798 [file] [log] [blame]
Jim Flynn01d02812020-04-29 21:12:13 +01001//
Jim Flynnbbfe6032020-07-20 16:57:44 +01002// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
Jim Flynn01d02812020-04-29 21:12:13 +01003// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
Jim Flynn01d02812020-04-29 21:12:13 +01008#include <armnn/profiling/ILocalPacketHandler.hpp>
Jim Flynn4c9ed1d2022-01-23 23:57:20 +00009#include <armnn/profiling/ProfilingOptions.hpp>
Jim Flynn01d02812020-04-29 21:12:13 +010010#include "ProfilingUtils.hpp"
11
Jim Flynnbbfe6032020-07-20 16:57:44 +010012#include <common/include/Packet.hpp>
13
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000014namespace arm
Jim Flynn01d02812020-04-29 21:12:13 +010015{
16
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000017namespace pipe
Jim Flynn01d02812020-04-29 21:12:13 +010018{
19
20class RequestCountersPacketHandler : public ILocalPacketHandler
21{
22public:
Jim Flynn4c9ed1d2022-01-23 23:57:20 +000023 explicit RequestCountersPacketHandler(uint32_t capturePeriod = arm::pipe::LOWEST_CAPTURE_PERIOD) :
Jim Flynn01d02812020-04-29 21:12:13 +010024 m_CapturePeriod(capturePeriod),
25 m_Connection(nullptr),
26 m_CounterDirectoryMessageHeader(ConstructHeader(0, 2)) {}
27
28 std::vector<uint32_t> GetHeadersAccepted() override; // ILocalPacketHandler
29
Jim Flynnbbfe6032020-07-20 16:57:44 +010030 void HandlePacket(const arm::pipe::Packet& packet) override; // ILocalPacketHandler
Jim Flynn01d02812020-04-29 21:12:13 +010031
32 void SetConnection(IInternalProfilingConnection* profilingConnection) override // ILocalPacketHandler
33 {
34 m_Connection = profilingConnection;
35 }
36
37private:
38 uint32_t m_CapturePeriod;
39 IInternalProfilingConnection* m_Connection;
40 uint32_t m_CounterDirectoryMessageHeader;
41 std::vector<uint16_t> m_IdList;
42
43 void SendCounterSelectionPacket();
44};
45
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000046} // namespace pipe
Jim Flynn01d02812020-04-29 21:12:13 +010047
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000048} // namespace arm