From 4833cea9036df428634cf64d8f1c4b54fc5da41f Mon Sep 17 00:00:00 2001 From: FinnWilliamsArm Date: Tue, 17 Sep 2019 16:53:53 +0100 Subject: IVGCVSW-3439 Create the Command Thread Signed-off-by: FinnWilliamsArm Change-Id: I9548c5937967f4c25841bb851273168379687bcd --- src/profiling/CommandThread.hpp | 53 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/profiling/CommandThread.hpp (limited to 'src/profiling/CommandThread.hpp') diff --git a/src/profiling/CommandThread.hpp b/src/profiling/CommandThread.hpp new file mode 100644 index 0000000000..6237cd2914 --- /dev/null +++ b/src/profiling/CommandThread.hpp @@ -0,0 +1,53 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include "CommandHandlerRegistry.hpp" +#include "IProfilingConnection.hpp" +#include "PacketVersionResolver.hpp" +#include "ProfilingService.hpp" + +#include +#include + +namespace armnn +{ + +namespace profiling +{ + +class CommandThread +{ +public: + CommandThread(uint32_t timeout, + bool stopAfterTimeout, + CommandHandlerRegistry& commandHandlerRegistry, + PacketVersionResolver& packetVersionResolver, + IProfilingConnection& socketProfilingConnection); + + void Start(); + void Stop(); + void Join(); + bool IsRunning() const; + bool StopAfterTimeout(bool StopAfterTimeout); + +private: + void WaitForPacket(); + + uint32_t m_Timeout; + bool m_StopAfterTimeout; + std::atomic m_IsRunning; + std::atomic m_KeepRunning; + std::thread m_CommandThread; + + CommandHandlerRegistry& m_CommandHandlerRegistry; + PacketVersionResolver& m_PacketVersionResolver; + IProfilingConnection& m_SocketProfilingConnection; +}; + +}//namespace profiling + +}//namespace armnn \ No newline at end of file -- cgit v1.2.1