1 // 2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 6 #pragma once 7 8 #include <common/include/CommandHandlerFunctor.hpp> 9 #include <common/include/Packet.hpp> 10 11 #include <vector> 12 13 namespace armnn 14 { 15 16 namespace gatordmock 17 { 18 19 struct CounterCaptureValues 20 { 21 uint64_t m_Timestamp; 22 std::vector<uint16_t> m_Uids; 23 std::vector<uint32_t> m_Values; 24 }; 25 26 class PeriodicCounterCaptureCommandHandler : public arm::pipe::CommandHandlerFunctor 27 { 28 29 public: 30 /** 31 * @param familyId The family of the packets this handler will service 32 * @param packetId The id of packets this handler will process. 33 * @param version The version of that id. 34 * @param quietOperation Optional parameter to turn off printouts. This is useful for unittests. 35 */ PeriodicCounterCaptureCommandHandler(uint32_t familyId,uint32_t packetId,uint32_t version,bool quietOperation=false)36 PeriodicCounterCaptureCommandHandler(uint32_t familyId, 37 uint32_t packetId, 38 uint32_t version, 39 bool quietOperation = false) 40 : CommandHandlerFunctor(familyId, packetId, version) 41 , m_QuietOperation(quietOperation) 42 {} 43 44 void operator()(const arm::pipe::Packet& packet) override; 45 46 CounterCaptureValues m_CounterCaptureValues; 47 48 uint64_t m_CurrentPeriodValue = 0; 49 50 private: 51 void ParseData(const arm::pipe::Packet& packet); 52 53 uint64_t m_FirstTimestamp = 0, m_SecondTimestamp = 0; 54 55 bool m_HeaderPrinted = false; 56 bool m_QuietOperation; 57 }; 58 59 } // namespace gatordmock 60 61 } // namespace armnn 62