blob: 4ab1c59c26b2069ce364264343debde14a4a0fce [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 Flynn3e9bc192022-03-23 23:01:26 +00008#include <client/src/ProfilingUtils.hpp>
Jim Flynn01d02812020-04-29 21:12:13 +01009
Jim Flynn27761832022-03-20 21:52:17 +000010#include <client/include/ILocalPacketHandler.hpp>
11#include <client/include/ProfilingOptions.hpp>
12
Jim Flynnbbfe6032020-07-20 16:57:44 +010013#include <common/include/Packet.hpp>
14
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000015namespace arm
Jim Flynn01d02812020-04-29 21:12:13 +010016{
17
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000018namespace pipe
Jim Flynn01d02812020-04-29 21:12:13 +010019{
20
21class RequestCountersPacketHandler : public ILocalPacketHandler
22{
23public:
Jim Flynn4c9ed1d2022-01-23 23:57:20 +000024 explicit RequestCountersPacketHandler(uint32_t capturePeriod = arm::pipe::LOWEST_CAPTURE_PERIOD) :
Jim Flynn01d02812020-04-29 21:12:13 +010025 m_CapturePeriod(capturePeriod),
26 m_Connection(nullptr),
27 m_CounterDirectoryMessageHeader(ConstructHeader(0, 2)) {}
28
29 std::vector<uint32_t> GetHeadersAccepted() override; // ILocalPacketHandler
30
Jim Flynnbbfe6032020-07-20 16:57:44 +010031 void HandlePacket(const arm::pipe::Packet& packet) override; // ILocalPacketHandler
Jim Flynn01d02812020-04-29 21:12:13 +010032
33 void SetConnection(IInternalProfilingConnection* profilingConnection) override // ILocalPacketHandler
34 {
35 m_Connection = profilingConnection;
36 }
37
38private:
39 uint32_t m_CapturePeriod;
40 IInternalProfilingConnection* m_Connection;
41 uint32_t m_CounterDirectoryMessageHeader;
42 std::vector<uint16_t> m_IdList;
43
44 void SendCounterSelectionPacket();
45};
46
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000047} // namespace pipe
Jim Flynn01d02812020-04-29 21:12:13 +010048
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000049} // namespace arm