From 397043fa3d900430e9e0f6d328b76898f9613388 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Thu, 17 Oct 2019 17:37:10 +0100 Subject: IVGCVSW-4002 Add FamilyId to CommandHandlerKey Change-Id: I0bb0bf77da2bcd7f4746078c4ccee9acc98638a7 Signed-off-by: Jim Flynn --- tests/profiling/gatordmock/GatordMockMain.cpp | 4 ++-- tests/profiling/gatordmock/GatordMockService.cpp | 3 ++- .../gatordmock/PeriodicCounterCaptureCommandHandler.hpp | 9 ++++++--- .../gatordmock/PeriodicCounterSelectionResponseHandler.hpp | 7 +++++-- tests/profiling/gatordmock/tests/GatordMockTests.cpp | 6 +++--- 5 files changed, 18 insertions(+), 11 deletions(-) (limited to 'tests/profiling/gatordmock') diff --git a/tests/profiling/gatordmock/GatordMockMain.cpp b/tests/profiling/gatordmock/GatordMockMain.cpp index 002d6c7c5a..2423493491 100644 --- a/tests/profiling/gatordmock/GatordMockMain.cpp +++ b/tests/profiling/gatordmock/GatordMockMain.cpp @@ -29,10 +29,10 @@ int main(int argc, char* argv[]) // This functor will receive back the selection response packet. armnn::gatordmock::PeriodicCounterSelectionResponseHandler periodicCounterSelectionResponseHandler( - 4, packetVersionResolver.ResolvePacketVersion(4).GetEncodedValue()); + 0, 4, packetVersionResolver.ResolvePacketVersion(4).GetEncodedValue()); // This functor will receive the counter data. armnn::gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler( - 0, packetVersionResolver.ResolvePacketVersion(0).GetEncodedValue()); + 1, 0, packetVersionResolver.ResolvePacketVersion(0).GetEncodedValue()); // Register different derived functors registry.RegisterFunctor(&periodicCounterSelectionResponseHandler); diff --git a/tests/profiling/gatordmock/GatordMockService.cpp b/tests/profiling/gatordmock/GatordMockService.cpp index 4b9d7524f3..2697b2f3e9 100644 --- a/tests/profiling/gatordmock/GatordMockService.cpp +++ b/tests/profiling/gatordmock/GatordMockService.cpp @@ -324,7 +324,8 @@ armnn::profiling::Packet GatordMockService::ReceivePacket() // Pass packet into the handler registry m_PacketsReceivedCount.operator++(std::memory_order::memory_order_release); m_HandlerRegistry - .GetFunctor(packetRx.GetPacketId(), + .GetFunctor(packetRx.GetPacketFamily(), + packetRx.GetPacketId(), packetVersionResolver.ResolvePacketVersion(packetRx.GetPacketId()).GetEncodedValue()) ->operator()(packetRx); diff --git a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp index b2fd48f4e8..4135a2fb06 100644 --- a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp +++ b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp @@ -29,13 +29,16 @@ class PeriodicCounterCaptureCommandHandler : public profiling::CommandHandlerFun public: /** - * + * @param familyId The family of the packets this handler will service * @param packetId The id of packets this handler will process. * @param version The version of that id. * @param quietOperation Optional parameter to turn off printouts. This is useful for unittests. */ - PeriodicCounterCaptureCommandHandler(uint32_t packetId, uint32_t version, bool quietOperation = false) - : CommandHandlerFunctor(packetId, version) + PeriodicCounterCaptureCommandHandler(uint32_t familyId, + uint32_t packetId, + uint32_t version, + bool quietOperation = false) + : CommandHandlerFunctor(familyId, packetId, version) , m_QuietOperation(quietOperation) {} diff --git a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp b/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp index e1172e2d68..faf9792ac0 100644 --- a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp +++ b/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp @@ -26,8 +26,11 @@ public: * @param version The version of that id. * @param quietOperation Optional parameter to turn off printouts. This is useful for unittests. */ - PeriodicCounterSelectionResponseHandler(uint32_t packetId, uint32_t version, bool quietOperation = true) - : CommandHandlerFunctor(packetId, version) + PeriodicCounterSelectionResponseHandler(uint32_t familyId, + uint32_t packetId, + uint32_t version, + bool quietOperation = true) + : CommandHandlerFunctor(familyId, packetId, version) , m_QuietOperation(quietOperation) {} diff --git a/tests/profiling/gatordmock/tests/GatordMockTests.cpp b/tests/profiling/gatordmock/tests/GatordMockTests.cpp index 3f58f39124..eb4b1783a4 100644 --- a/tests/profiling/gatordmock/tests/GatordMockTests.cpp +++ b/tests/profiling/gatordmock/tests/GatordMockTests.cpp @@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(CounterCaptureHandlingTest) profiling::Packet packet2(headerWord1, dataLength, uniqueData2); uint32_t version = 1; - gatordmock::PeriodicCounterCaptureCommandHandler commandHandler(headerWord1, version, true); + gatordmock::PeriodicCounterCaptureCommandHandler commandHandler(0, 4, version, false); // Simulate two separate packets coming in to calculate period commandHandler(packet1); @@ -123,14 +123,14 @@ BOOST_AUTO_TEST_CASE(GatorDMockEndToEnd) // performance data. // Initialise functors and register into the CommandHandlerRegistry - uint32_t counterCaptureHeader = ConstructHeader(1, 0); uint32_t version = 1; // Create the Command Handler Registry profiling::CommandHandlerRegistry registry; // Update with derived functors - gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(counterCaptureHeader, version, true); + gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(0, 4, version, false); + // Register different derived functors registry.RegisterFunctor(&counterCaptureCommandHandler); -- cgit v1.2.1