From cdfb9417ddce28a5cbd33f8049a147168a26aa9b Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Fri, 8 Nov 2019 11:23:06 +0000 Subject: IVGCVSW-4073 Send stream info in the ConnectionAcknowledgedCommandHandler * Added call to ISendTimelinePacket::SendStreamMetaDataPacket * Added call to ISendTimelinePacket::SendTimelineMessageDirectoryPackage * Added new StreamMetadataCommandHandler class to the mock Gatord service * Updated code and unit tests * Added include paths to the gatord mock target Signed-off-by: Matteo Martincigh Change-Id: Ic6d200b513175884607b7c0563cbfa4942ff2fc6 --- src/profiling/ConnectionAcknowledgedCommandHandler.cpp | 3 +++ src/profiling/ConnectionAcknowledgedCommandHandler.hpp | 4 ++++ src/profiling/ProfilingService.hpp | 4 ++++ src/profiling/test/ProfilingTests.cpp | 13 ++++++++++--- 4 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.cpp b/src/profiling/ConnectionAcknowledgedCommandHandler.cpp index a0825c7ba7..630b555b6e 100644 --- a/src/profiling/ConnectionAcknowledgedCommandHandler.cpp +++ b/src/profiling/ConnectionAcknowledgedCommandHandler.cpp @@ -38,7 +38,10 @@ void ConnectionAcknowledgedCommandHandler::operator()(const Packet& packet) // Once a Connection Acknowledged packet has been received, move to the Active state immediately m_StateMachine.TransitionToState(ProfilingState::Active); + // Send all the packet required for the handshake with the external profiling service + m_SendCounterPacket.SendStreamMetaDataPacket(); m_SendCounterPacket.SendCounterDirectoryPacket(m_CounterDirectory); + m_SendTimelinePacket.SendTimelineMessageDirectoryPackage(); // Notify the Send Thread that new data is available in the Counter Stream Buffer m_SendCounterPacket.SetReadyToRead(); diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp index 7e7904de0f..05559a3f9f 100644 --- a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp +++ b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp @@ -7,6 +7,7 @@ #include "CommandHandlerFunctor.hpp" #include "ISendCounterPacket.hpp" +#include "ISendTimelinePacket.hpp" #include "Packet.hpp" #include "ProfilingStateMachine.hpp" @@ -25,10 +26,12 @@ public: uint32_t version, ICounterDirectory& counterDirectory, ISendCounterPacket& sendCounterPacket, + ISendTimelinePacket& sendTimelinePacket, ProfilingStateMachine& profilingStateMachine) : CommandHandlerFunctor(familyId, packetId, version) , m_CounterDirectory(counterDirectory) , m_SendCounterPacket(sendCounterPacket) + , m_SendTimelinePacket(sendTimelinePacket) , m_StateMachine(profilingStateMachine) {} @@ -37,6 +40,7 @@ public: private: const ICounterDirectory& m_CounterDirectory; ISendCounterPacket& m_SendCounterPacket; + ISendTimelinePacket& m_SendTimelinePacket; ProfilingStateMachine& m_StateMachine; }; diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp index 427cdbd0c4..b68b6524f5 100644 --- a/src/profiling/ProfilingService.hpp +++ b/src/profiling/ProfilingService.hpp @@ -18,6 +18,7 @@ #include "ProfilingStateMachine.hpp" #include "RequestCounterDirectoryCommandHandler.hpp" #include "SendCounterPacket.hpp" +#include "SendTimelinePacket.hpp" #include "TimelinePacketWriterFactory.hpp" namespace armnn @@ -105,6 +106,7 @@ private: CommandHandler m_CommandHandler; BufferManager m_BufferManager; SendCounterPacket m_SendCounterPacket; + SendTimelinePacket m_SendTimelinePacket; Holder m_Holder; PeriodicCounterCapture m_PeriodicCounterCapture; ConnectionAcknowledgedCommandHandler m_ConnectionAcknowledgedCommandHandler; @@ -132,12 +134,14 @@ protected: m_PacketVersionResolver) , m_BufferManager() , m_SendCounterPacket(m_StateMachine, m_BufferManager) + , m_SendTimelinePacket(m_BufferManager) , m_PeriodicCounterCapture(m_Holder, m_SendCounterPacket, *this) , m_ConnectionAcknowledgedCommandHandler(0, 1, m_PacketVersionResolver.ResolvePacketVersion(0, 1).GetEncodedValue(), m_CounterDirectory, m_SendCounterPacket, + m_SendTimelinePacket, m_StateMachine) , m_RequestCounterDirectoryCommandHandler(0, 3, diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index 79a241b540..b197273dc5 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include @@ -128,8 +130,11 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandler) CounterDirectory counterDirectory; MockBufferManager mockBuffer(1024); SendCounterPacket sendCounterPacket(profilingStateMachine, mockBuffer); + SendTimelinePacket sendTimelinePacket(mockBuffer); + ConnectionAcknowledgedCommandHandler connectionAcknowledgedCommandHandler(0, 1, 4194304, counterDirectory, - sendCounterPacket, profilingStateMachine); + sendCounterPacket, sendTimelinePacket, + profilingStateMachine); CommandHandlerRegistry commandHandlerRegistry; commandHandlerRegistry.RegisterFunctor(&connectionAcknowledgedCommandHandler); @@ -1731,9 +1736,10 @@ BOOST_AUTO_TEST_CASE(CheckConnectionAcknowledged) CounterDirectory counterDirectory; MockBufferManager mockBuffer(1024); SendCounterPacket sendCounterPacket(profilingState, mockBuffer); + SendTimelinePacket sendTimelinePacket(mockBuffer); ConnectionAcknowledgedCommandHandler commandHandler(packetFamilyId, connectionPacketId, version, counterDirectory, - sendCounterPacket, profilingState); + sendCounterPacket, sendTimelinePacket, profilingState); // command handler received packet on ProfilingState::Uninitialised BOOST_CHECK_THROW(commandHandler(packetA), armnn::Exception); @@ -1759,7 +1765,8 @@ BOOST_AUTO_TEST_CASE(CheckConnectionAcknowledged) profilingState.TransitionToState(ProfilingState::NotConnected); profilingState.TransitionToState(ProfilingState::WaitingForAck); ConnectionAcknowledgedCommandHandler differentCommandHandler(packetFamilyId, differentPacketId, version, - counterDirectory, sendCounterPacket, profilingState); + counterDirectory, sendCounterPacket, + sendTimelinePacket, profilingState); BOOST_CHECK_THROW(differentCommandHandler(packetB), armnn::Exception); } -- cgit v1.2.1