20.02
|
A class that implements a Mock Gatord server. More...
#include <GatordMockService.hpp>
Public Member Functions | |
GatordMockService (armnn::profiling::CommandHandlerRegistry ®istry, bool echoPackets) | |
~GatordMockService () | |
bool | OpenListeningSocket (std::string udsNamespace) |
Establish the Unix domain socket and set it to listen for connections. More... | |
armnnUtils::Sockets::Socket | BlockForOneClient () |
Block waiting to accept one client to connect to the UDS. More... | |
bool | WaitForStreamMetaData () |
Once the connection is open wait to receive the stream meta data packet from the client. More... | |
void | SendConnectionAck () |
Send a connection acknowledged packet back to the client. More... | |
void | SendRequestCounterDir () |
Send a request counter directory packet back to the client. More... | |
bool | LaunchReceivingThread () |
Start the thread that will receive all packets and print them nicely to stdout. More... | |
uint32_t | GetPacketsReceivedCount () |
Return the total number of periodic counter capture packets received since the receive thread started. More... | |
void | WaitForReceivingThread () |
This is a placeholder method to prevent main exiting. More... | |
bool | ReceiveThreadRunning () |
void | SendPeriodicCounterSelectionList (uint32_t period, std::vector< uint16_t > counters) |
Send the counter list to ArmNN. More... | |
void | WaitCommand (uint32_t timeout) |
Execute the WAIT command from the comamnd file. More... | |
uint32_t | GetStreamMetadataVersion () |
uint32_t | GetStreamMetadataMaxDataLen () |
uint32_t | GetStreamMetadataPid () |
A class that implements a Mock Gatord server.
It will listen on a specified Unix domain socket (UDS) namespace for client connections. It will then allow opertaions to manage coutners while receiving counter data.
Definition at line 37 of file GatordMockService.hpp.
|
inline |
registry | reference to a command handler registry. |
echoPackets | if true the raw packets will be printed to stdout. |
Definition at line 42 of file GatordMockService.hpp.
|
inline |
Sockets::Socket BlockForOneClient | ( | ) |
Block waiting to accept one client to connect to the UDS.
Definition at line 58 of file GatordMockService.cpp.
References armnnUtils::Sockets::Accept().
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Return the total number of periodic counter capture packets received since the receive thread started.
Definition at line 82 of file GatordMockService.hpp.
|
inline |
Definition at line 108 of file GatordMockService.hpp.
|
inline |
Definition at line 113 of file GatordMockService.hpp.
|
inline |
Definition at line 103 of file GatordMockService.hpp.
bool LaunchReceivingThread | ( | ) |
Start the thread that will receive all packets and print them nicely to stdout.
Definition at line 149 of file GatordMockService.cpp.
References armnnUtils::Sockets::Close(), and armnnUtils::Sockets::SetNonBlocking().
Referenced by BOOST_AUTO_TEST_CASE().
bool OpenListeningSocket | ( | std::string | udsNamespace | ) |
Establish the Unix domain socket and set it to listen for connections.
udsNamespace | the namespace (socket address) associated with the listener. |
Definition at line 27 of file GatordMockService.cpp.
References armnnUtils::Sockets::Initialize().
Referenced by BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 92 of file GatordMockService.hpp.
Referenced by CommandFileParser::ParseFile(), and GatordMockService::WaitCommand().
void SendConnectionAck | ( | ) |
Send a connection acknowledged packet back to the client.
Definition at line 129 of file GatordMockService.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
void SendPeriodicCounterSelectionList | ( | uint32_t | period, |
std::vector< uint16_t > | counters | ||
) |
Send the counter list to ArmNN.
Definition at line 181 of file GatordMockService.cpp.
References armnn::profiling::WriteUint16(), and armnn::profiling::WriteUint32().
Referenced by CommandFileParser::ParseFile().
void SendRequestCounterDir | ( | ) |
Send a request counter directory packet back to the client.
Definition at line 139 of file GatordMockService.cpp.
Referenced by CommandFileParser::ParseFile().
void WaitCommand | ( | uint32_t | timeout | ) |
Execute the WAIT command from the comamnd file.
Definition at line 214 of file GatordMockService.cpp.
References armnn::gatordmock::BeWire, Version::GetEncodedValue(), Packet::GetLength(), Packet::GetPacketFamily(), Packet::GetPacketId(), armnnUtils::Sockets::Ioctl(), armnnUtils::Sockets::Poll(), armnnUtils::Sockets::Read(), armnn::gatordmock::ReceivedData, armnn::gatordmock::ReceivedHeader, GatordMockService::ReceiveThreadRunning(), PacketVersionResolver::ResolvePacketVersion(), armnn::gatordmock::Sending, Exception::what(), and armnnUtils::Sockets::Write().
Referenced by CommandFileParser::ParseFile().
void WaitForReceivingThread | ( | ) |
This is a placeholder method to prevent main exiting.
It can be removed once the command handling code is added.
Definition at line 166 of file GatordMockService.cpp.
Referenced by BOOST_AUTO_TEST_CASE().
bool WaitForStreamMetaData | ( | ) |
Once the connection is open wait to receive the stream meta data packet from the client.
Reading this packet differs from others as we need to determine endianness.
Definition at line 69 of file GatordMockService.cpp.
References armnn::gatordmock::BeWire, armnn::gatordmock::LeWire, armnnUtils::Sockets::Read(), armnn::gatordmock::ReceivedData, and armnn::gatordmock::ReceivedHeader.
Referenced by BOOST_AUTO_TEST_CASE().