ArmNN
 21.08
CommandHandler Class Reference

#include <CommandHandler.hpp>

Public Member Functions

 CommandHandler (uint32_t timeout, bool stopAfterTimeout, arm::pipe::CommandHandlerRegistry &commandHandlerRegistry, arm::pipe::PacketVersionResolver &packetVersionResolver)
 
 ~CommandHandler ()
 
void SetTimeout (uint32_t timeout)
 
void SetStopAfterTimeout (bool stopAfterTimeout)
 
void Start (IProfilingConnection &profilingConnection)
 
void Stop ()
 
bool IsRunning () const
 

Detailed Description

Definition at line 22 of file CommandHandler.hpp.

Constructor & Destructor Documentation

◆ CommandHandler()

CommandHandler ( uint32_t  timeout,
bool  stopAfterTimeout,
arm::pipe::CommandHandlerRegistry &  commandHandlerRegistry,
arm::pipe::PacketVersionResolver &  packetVersionResolver 
)
inline

Definition at line 25 of file CommandHandler.hpp.

29  : m_Timeout(timeout),
30  m_StopAfterTimeout(stopAfterTimeout),
31  m_IsRunning(false),
32  m_KeepRunning(false),
33  m_CommandThread(),
34  m_CommandHandlerRegistry(commandHandlerRegistry),
35  m_PacketVersionResolver(packetVersionResolver)
36  {}

◆ ~CommandHandler()

~CommandHandler ( )
inline

Definition at line 37 of file CommandHandler.hpp.

References CommandHandler::Stop().

Member Function Documentation

◆ IsRunning()

bool IsRunning ( ) const
inline

Definition at line 44 of file CommandHandler.hpp.

Referenced by CommandHandler::Start(), and TEST_SUITE().

44 { return m_IsRunning.load(); }

◆ SetStopAfterTimeout()

void SetStopAfterTimeout ( bool  stopAfterTimeout)
inline

Definition at line 40 of file CommandHandler.hpp.

References CommandHandler::Start(), and CommandHandler::Stop().

Referenced by TEST_SUITE().

40 { m_StopAfterTimeout.store(stopAfterTimeout); }

◆ SetTimeout()

void SetTimeout ( uint32_t  timeout)
inline

Definition at line 39 of file CommandHandler.hpp.

39 { m_Timeout.store(timeout); }

◆ Start()

void Start ( IProfilingConnection profilingConnection)

Definition at line 17 of file CommandHandler.cpp.

References CommandHandler::IsRunning().

Referenced by CommandHandler::SetStopAfterTimeout(), TEST_SUITE(), and ProfilingService::Update().

18 {
19  if (IsRunning())
20  {
21  return;
22  }
23 
24  if (m_CommandThread.joinable())
25  {
26  m_CommandThread.join();
27  }
28 
29  m_IsRunning.store(true);
30  m_KeepRunning.store(true);
31  m_CommandThread = std::thread(&CommandHandler::HandleCommands, this, std::ref(profilingConnection));
32 }

◆ Stop()

void Stop ( )

Definition at line 34 of file CommandHandler.cpp.

References ARMNN_ASSERT, ARMNN_LOG, IProfilingConnection::IsOpen(), IProfilingConnection::ReadPacket(), armnn::warning, and Exception::what().

Referenced by ProfilingService::GetSendTimelinePacket(), CommandHandler::SetStopAfterTimeout(), TEST_SUITE(), ProfilingService::Update(), and CommandHandler::~CommandHandler().

35 {
36  m_KeepRunning.store(false);
37 
38  if (m_CommandThread.joinable())
39  {
40  m_CommandThread.join();
41  }
42 }

The documentation for this class was generated from the following files: