From b682d840bb0b4cc34f4febb69c2385feec880ae1 Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Wed, 16 Oct 2019 12:24:20 +0100 Subject: IVGCVSW-3721 Add support for startup sequence (Mock Gatord service). * Updated ExecuteNetwork to propagate a configured Runtime down to RunTest. * Fixed the creation of PeriodicCounterCaptureCommandHandler to match other handlers. * Moved around some printouts to make the MockGatorD output more useful. * Added details to the exception handling for problems in the GatordMockService receive thread. * Mockutils::ConstructHeader is only used in GatordMockTests. Moved it in there and deleted MockUtils.hpp * Refactored SendPeriodicCounterSelectionList to use ProfilingUtils. * Added PeriodicCounterSelectionResponseHandler to received packet echoed back. Signed-off-by: Colm Donelan Change-Id: I4accdbf6cf5dd3f7dcc12b210b8360b4a5e4e277 --- tests/profiling/gatordmock/GatordMockMain.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'tests/profiling/gatordmock/GatordMockMain.cpp') diff --git a/tests/profiling/gatordmock/GatordMockMain.cpp b/tests/profiling/gatordmock/GatordMockMain.cpp index 500b016669..002d6c7c5a 100644 --- a/tests/profiling/gatordmock/GatordMockMain.cpp +++ b/tests/profiling/gatordmock/GatordMockMain.cpp @@ -3,15 +3,18 @@ // SPDX-License-Identifier: MIT // +#include "../../../src/profiling/PacketVersionResolver.hpp" +#include "../../../src/profiling/PeriodicCounterSelectionCommandHandler.hpp" #include "CommandFileParser.hpp" #include "CommandLineProcessor.hpp" #include "GatordMockService.hpp" -#include "MockUtils.hpp" #include "PeriodicCounterCaptureCommandHandler.hpp" +#include "PeriodicCounterSelectionResponseHandler.hpp" +#include #include -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { // Process command line arguments armnn::gatordmock::CommandLineProcessor cmdLine; @@ -20,21 +23,19 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } - // Initialise functors and register into the CommandHandlerRegistry - uint32_t version = 1; - - // Create headers - uint32_t counterCaptureCommandHeader = armnn::gatordmock::ConstructHeader(1,0,0); - + armnn::profiling::PacketVersionResolver packetVersionResolver; // Create the Command Handler Registry armnn::profiling::CommandHandlerRegistry registry; - // Update with derived functors - armnn::gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(counterCaptureCommandHeader, - version, - cmdLine.IsEchoEnabled()); + // This functor will receive back the selection response packet. + armnn::gatordmock::PeriodicCounterSelectionResponseHandler periodicCounterSelectionResponseHandler( + 4, packetVersionResolver.ResolvePacketVersion(4).GetEncodedValue()); + // This functor will receive the counter data. + armnn::gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler( + 0, packetVersionResolver.ResolvePacketVersion(0).GetEncodedValue()); // Register different derived functors + registry.RegisterFunctor(&periodicCounterSelectionResponseHandler); registry.RegisterFunctor(&counterCaptureCommandHandler); armnn::gatordmock::GatordMockService mockService(registry, cmdLine.IsEchoEnabled()); @@ -43,12 +44,14 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } + std::cout << "Bound to UDS namespace: \\0" << cmdLine.GetUdsNamespace() << std::endl; // Wait for a single connection. if (-1 == mockService.BlockForOneClient()) { return EXIT_FAILURE; } + std::cout << "Client connection established." << std::endl; // Send receive the strweam metadata and send connection ack. if (!mockService.WaitForStreamMetaData()) -- cgit v1.2.1