22 #include <BasePipeServer.hpp> 40 GatordMockService(std::unique_ptr<armnnProfiling::BasePipeServer> clientConnection,
bool echoPackets)
41 : m_BasePipeServer(
std::move(clientConnection))
42 , m_EchoPackets(echoPackets)
43 , m_CloseReceivingThread(
false)
44 , m_PacketVersionResolver()
47 , m_CounterCaptureCommandHandler(
48 0, 4, m_PacketVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue(), !echoPackets)
49 , m_StreamMetadataCommandHandler(
50 0, 0, m_PacketVersionResolver.ResolvePacketVersion(0, 0).GetEncodedValue(), !echoPackets)
52 , m_StubCommandHandler(3, 0, m_PacketVersionResolver.ResolvePacketVersion(0, 3).GetEncodedValue())
53 , m_DirectoryCaptureCommandHandler(
54 0, 2, m_PacketVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue(), !echoPackets)
55 , m_TimelineCaptureCommandHandler(
56 1, 1, m_PacketVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), m_TimelineDecoder)
57 , m_TimelineDirectoryCaptureCommandHandler(
58 1, 0, m_PacketVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(),
59 m_TimelineCaptureCommandHandler, !echoPackets)
67 m_HandlerRegistry.
RegisterFunctor(&m_TimelineDirectoryCaptureCommandHandler);
101 return m_PacketsReceivedCount.load(std::memory_order_acquire);
111 return !m_CloseReceivingThread.load();
122 return m_DirectoryCaptureCommandHandler;
127 return m_TimelineDecoder;
132 return m_TimelineDirectoryCaptureCommandHandler;
138 std::unique_ptr<armnnProfiling::BasePipeServer> m_BasePipeServer;
140 std::atomic<uint32_t> m_PacketsReceivedCount;
143 std::thread m_ListeningThread;
144 std::atomic<bool> m_CloseReceivingThread;
void SetDefaultCallbacks()
Copyright (c) 2020 ARM Limited.
void SendDeactivateTimelinePacket()
Send a deactivate timeline packet back to the client.
timelinedecoder::TimelineDirectoryCaptureCommandHandler & GetTimelineDirectoryCaptureCommandHandler()
void SendActivateTimelinePacket()
Send a activate timeline packet back to the client.
bool WaitForStreamMetaData()
Once the connection is open wait to receive the stream meta data packet from the client.
void SendRequestCounterDir()
Send a request counter directory packet back to the client.
bool ReceiveThreadRunning()
void RegisterFunctor(CommandHandlerFunctor *functor, uint32_t familyId, uint32_t packetId, uint32_t version)
bool LaunchReceivingThread()
Start the thread that will receive all packets and print them nicely to stdout.
profiling::DirectoryCaptureCommandHandler & GetDirectoryCaptureCommandHandler()
A class that implements a Mock Gatord server.
uint32_t GetPacketsReceivedCount()
Return the total number of periodic counter capture packets received since the receive thread started...
void WaitCommand(uint32_t timeout)
Execute the WAIT command from the comamnd file.
void SendPeriodicCounterSelectionList(uint32_t period, std::vector< uint16_t > counters)
Send the counter list to ArmNN.
GatordMockService(std::unique_ptr< armnnProfiling::BasePipeServer > clientConnection, bool echoPackets)
void WaitForReceivingThread()
This is a placeholder method to prevent main exiting.
timelinedecoder::TimelineDecoder & GetTimelineDecoder()
GatordMockService & operator=(const GatordMockService &)=delete
void SendConnectionAck()
Send a connection acknowledged packet back to the client.