From a21620d32a8a0a8d527c061e2a22d51009d75877 Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Fri, 11 Oct 2019 13:09:49 +0100 Subject: IVGCVSW-3721 Add support for startup sequence (Mock Gatord service). * Receive and process the stream metadata from the client. * Send the connection ack packet. * Wait in a receiving thread and print the packets. * GatordMockTest and Impl for PeriodicCounterCapture CommandHandler * CaptureData class to retain packet data * MockUtils * Update SocketProfilingConnection to fix non blocking receipt of packets. * Restructure directory layout following review comments. * Extract the mock service into a static library in the cmake files. Signed-off-by: Colm Donelan Signed-off-by: Keith Davis Signed-off-by: Mike Kelly Signed-off-by: Finn Williams Signed-off-by: Kevin May Change-Id: I33c1c9f93976708c9315f71290d42cff53b8c075 --- .../PeriodicCounterCaptureCommandHandler.hpp | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp (limited to 'tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp') diff --git a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp new file mode 100644 index 0000000000..7f46d8e102 --- /dev/null +++ b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp @@ -0,0 +1,54 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include "../../armnn/src/profiling/Packet.hpp" +#include "../../armnn/src/profiling/CommandHandlerFunctor.hpp" + +#include + +namespace armnn +{ + +namespace gatordmock +{ + +struct CounterCaptureValues +{ + uint64_t m_Timestamp; + std::vector m_Uids; + std::vector 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 \ No newline at end of file -- cgit v1.2.1