From bbfe603e5ae42317a2b67d713d00882bea341c88 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Mon, 20 Jul 2020 16:57:44 +0100 Subject: IVGCVSW-5166 Pull out the common and server side code into standalone libraries Change-Id: I180f84c493a9b2be4b93b25d312ebdd9e71b1735 Signed-off-by: Jim Flynn --- tests/profiling/gatordmock/CommandFileParser.cpp | 2 +- tests/profiling/gatordmock/CommandFileParser.hpp | 2 +- .../profiling/gatordmock/CommandLineProcessor.cpp | 2 +- .../profiling/gatordmock/CommandLineProcessor.hpp | 2 +- tests/profiling/gatordmock/CounterDirectory.hpp | 7 +-- tests/profiling/gatordmock/GatordMockMain.cpp | 10 ++--- tests/profiling/gatordmock/GatordMockService.cpp | 36 +++++++-------- tests/profiling/gatordmock/GatordMockService.hpp | 51 ++++++++++++---------- .../PeriodicCounterCaptureCommandHandler.cpp | 40 ++++++++--------- .../PeriodicCounterCaptureCommandHandler.hpp | 12 ++--- .../PeriodicCounterSelectionResponseHandler.cpp | 8 ++-- .../PeriodicCounterSelectionResponseHandler.hpp | 10 ++--- .../gatordmock/StreamMetadataCommandHandler.cpp | 35 ++++++++------- .../gatordmock/StreamMetadataCommandHandler.hpp | 12 ++--- tests/profiling/gatordmock/StubCommandHandler.hpp | 12 ++--- .../profiling/gatordmock/tests/GatordMockTests.cpp | 36 +++++++-------- 16 files changed, 137 insertions(+), 140 deletions(-) (limited to 'tests/profiling/gatordmock') diff --git a/tests/profiling/gatordmock/CommandFileParser.cpp b/tests/profiling/gatordmock/CommandFileParser.cpp index 503af8fc08..35a59ec537 100644 --- a/tests/profiling/gatordmock/CommandFileParser.cpp +++ b/tests/profiling/gatordmock/CommandFileParser.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // diff --git a/tests/profiling/gatordmock/CommandFileParser.hpp b/tests/profiling/gatordmock/CommandFileParser.hpp index fd4a4fdf38..cd2c8e6976 100644 --- a/tests/profiling/gatordmock/CommandFileParser.hpp +++ b/tests/profiling/gatordmock/CommandFileParser.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // diff --git a/tests/profiling/gatordmock/CommandLineProcessor.cpp b/tests/profiling/gatordmock/CommandLineProcessor.cpp index 55b51137bc..2903dbbfe3 100644 --- a/tests/profiling/gatordmock/CommandLineProcessor.cpp +++ b/tests/profiling/gatordmock/CommandLineProcessor.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // diff --git a/tests/profiling/gatordmock/CommandLineProcessor.hpp b/tests/profiling/gatordmock/CommandLineProcessor.hpp index 532948a5cf..1724470dbb 100644 --- a/tests/profiling/gatordmock/CommandLineProcessor.hpp +++ b/tests/profiling/gatordmock/CommandLineProcessor.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once diff --git a/tests/profiling/gatordmock/CounterDirectory.hpp b/tests/profiling/gatordmock/CounterDirectory.hpp index 31718dd817..14e7a94383 100644 --- a/tests/profiling/gatordmock/CounterDirectory.hpp +++ b/tests/profiling/gatordmock/CounterDirectory.hpp @@ -1,5 +1,5 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -9,8 +9,9 @@ #include "GatordMockService.hpp" #include "MockUtils.hpp" -#include -#include "CommandHandlerFunctor.hpp" +#include +#include + #include "SendCounterPacket.hpp" #include "IPeriodicCounterCapture.hpp" diff --git a/tests/profiling/gatordmock/GatordMockMain.cpp b/tests/profiling/gatordmock/GatordMockMain.cpp index 5d6e8869f6..cda1ff148f 100644 --- a/tests/profiling/gatordmock/GatordMockMain.cpp +++ b/tests/profiling/gatordmock/GatordMockMain.cpp @@ -1,5 +1,5 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // @@ -7,7 +7,7 @@ #include "CommandLineProcessor.hpp" #include "GatordMockService.hpp" -#include +#include #include #include @@ -19,11 +19,11 @@ using namespace gatordmock; static volatile bool run = true; void exit_capture(int signum) { - IgnoreUnused(signum); + arm::pipe::IgnoreUnused(signum); run = false; } -bool CreateMockService(std::unique_ptr basePipeServer, +bool CreateMockService(std::unique_ptr basePipeServer, std::string commandFile, bool isEchoEnabled) { @@ -65,7 +65,7 @@ int main(int argc, char* argv[]) std::string commandFile = cmdLine.GetCommandFile(); // make the socket non-blocking so we can exit the loop - armnnProfiling::ConnectionHandler connectionHandler(cmdLine.GetUdsNamespace(), true); + arm::pipe::ConnectionHandler connectionHandler(cmdLine.GetUdsNamespace(), true); while (run) { diff --git a/tests/profiling/gatordmock/GatordMockService.cpp b/tests/profiling/gatordmock/GatordMockService.cpp index 13f688225b..8514091432 100644 --- a/tests/profiling/gatordmock/GatordMockService.cpp +++ b/tests/profiling/gatordmock/GatordMockService.cpp @@ -1,24 +1,20 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #include "GatordMockService.hpp" -#include -#include -#include -#include - -#include +#include +#include +#include +#include +#include #include -#include #include #include -using namespace armnnUtils; - namespace armnn { @@ -125,11 +121,11 @@ void GatordMockService::SendPeriodicCounterSelectionList(uint32_t period, std::v unsigned char* data = reinterpret_cast(uniqueData.get()); uint32_t offset = 0; - profiling::WriteUint32(data, offset, period); + arm::pipe::WriteUint32(data, offset, period); offset += 4; for (std::vector::iterator it = counters.begin(); it != counters.end(); ++it) { - profiling::WriteUint16(data, offset, *it); + arm::pipe::WriteUint16(data, offset, *it); offset += 2; } @@ -164,33 +160,33 @@ void GatordMockService::ReceiveLoop() { try { - profiling::Packet packet = m_BasePipeServer.get()->WaitForPacket(500); + arm::pipe::Packet packet = m_BasePipeServer.get()->WaitForPacket(500); - profiling::PacketVersionResolver packetVersionResolver; + arm::pipe::PacketVersionResolver packetVersionResolver; - profiling::Version version = + arm::pipe::Version version = packetVersionResolver.ResolvePacketVersion(packet.GetPacketFamily(), packet.GetPacketId()); - profiling::CommandHandlerFunctor* commandHandlerFunctor = m_HandlerRegistry.GetFunctor( + arm::pipe::CommandHandlerFunctor* commandHandlerFunctor = m_HandlerRegistry.GetFunctor( packet.GetPacketFamily(), packet.GetPacketId(), version.GetEncodedValue()); - ARMNN_ASSERT(commandHandlerFunctor); + ARM_PIPE_ASSERT(commandHandlerFunctor); commandHandlerFunctor->operator()(packet); } - catch (const armnn::TimeoutException&) + catch (const arm::pipe::TimeoutException&) { // In this case we ignore timeouts and and keep trying to receive. } - catch (const armnn::InvalidArgumentException& e) + catch (const arm::pipe::InvalidArgumentException& e) { // We couldn't find a functor to handle the packet? std::cerr << "Packet received that could not be processed: " << e.what() << std::endl; } - catch (const armnn::RuntimeException& e) + catch (const arm::pipe::ProfilingException& e) { // A runtime exception occurred which means we must exit the loop. std::cerr << "Receive thread closing: " << e.what() << std::endl; diff --git a/tests/profiling/gatordmock/GatordMockService.hpp b/tests/profiling/gatordmock/GatordMockService.hpp index 8bad41cdfb..1c45d4ea98 100644 --- a/tests/profiling/gatordmock/GatordMockService.hpp +++ b/tests/profiling/gatordmock/GatordMockService.hpp @@ -1,28 +1,31 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once -#include -#include - -#include -#include -#include - -#include -#include -#include -#include +// local includes #include "PeriodicCounterCaptureCommandHandler.hpp" #include "StreamMetadataCommandHandler.hpp" +#include "StubCommandHandler.hpp" -#include +#include +#include +#include -#include "PacketVersionResolver.hpp" -#include "StubCommandHandler.hpp" +#include + +#include +#include +#include + +// src/profiling +#include + +#include +#include +#include namespace armnn { @@ -37,7 +40,7 @@ class GatordMockService public: /// @param registry reference to a command handler registry. /// @param echoPackets if true the raw packets will be printed to stdout. - GatordMockService(std::unique_ptr clientConnection, bool echoPackets) + GatordMockService(std::unique_ptr clientConnection, bool echoPackets) : m_BasePipeServer(std::move(clientConnection)) , m_EchoPackets(echoPackets) , m_CloseReceivingThread(false) @@ -122,12 +125,12 @@ public: return m_DirectoryCaptureCommandHandler; } - timelinedecoder::TimelineDecoder& GetTimelineDecoder() + arm::pipe::TimelineDecoder& GetTimelineDecoder() { return m_TimelineDecoder; } - timelinedecoder::TimelineDirectoryCaptureCommandHandler& GetTimelineDirectoryCaptureCommandHandler() + arm::pipe::TimelineDirectoryCaptureCommandHandler& GetTimelineDirectoryCaptureCommandHandler() { return m_TimelineDirectoryCaptureCommandHandler; } @@ -135,7 +138,7 @@ public: private: void ReceiveLoop(); - std::unique_ptr m_BasePipeServer; + std::unique_ptr m_BasePipeServer; std::atomic m_PacketsReceivedCount; @@ -143,10 +146,10 @@ private: std::thread m_ListeningThread; std::atomic m_CloseReceivingThread; - profiling::PacketVersionResolver m_PacketVersionResolver; - profiling::CommandHandlerRegistry m_HandlerRegistry; + arm::pipe::PacketVersionResolver m_PacketVersionResolver; + arm::pipe::CommandHandlerRegistry m_HandlerRegistry; - timelinedecoder::TimelineDecoder m_TimelineDecoder; + arm::pipe::TimelineDecoder m_TimelineDecoder; gatordmock::PeriodicCounterCaptureCommandHandler m_CounterCaptureCommandHandler; gatordmock::StreamMetadataCommandHandler m_StreamMetadataCommandHandler; @@ -154,8 +157,8 @@ private: profiling::DirectoryCaptureCommandHandler m_DirectoryCaptureCommandHandler; - timelinedecoder::TimelineCaptureCommandHandler m_TimelineCaptureCommandHandler; - timelinedecoder::TimelineDirectoryCaptureCommandHandler m_TimelineDirectoryCaptureCommandHandler; + arm::pipe::TimelineCaptureCommandHandler m_TimelineCaptureCommandHandler; + arm::pipe::TimelineDirectoryCaptureCommandHandler m_TimelineDirectoryCaptureCommandHandler; }; } // namespace gatordmock diff --git a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp index 9dd7064c90..fac813979d 100644 --- a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp +++ b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.cpp @@ -1,13 +1,13 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #include "PeriodicCounterCaptureCommandHandler.hpp" -#include +#include -#include +#include #include @@ -17,16 +17,14 @@ namespace armnn namespace gatordmock { -using boost::numeric_cast; - -void PeriodicCounterCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet) +void PeriodicCounterCaptureCommandHandler::ParseData(const arm::pipe::Packet& packet) { std::vector counterIds; std::vector counterValues; - uint32_t sizeOfUint64 = numeric_cast(sizeof(uint64_t)); - uint32_t sizeOfUint32 = numeric_cast(sizeof(uint32_t)); - uint32_t sizeOfUint16 = numeric_cast(sizeof(uint16_t)); + uint32_t sizeOfUint64 = armnn::numeric_cast(sizeof(uint64_t)); + uint32_t sizeOfUint32 = armnn::numeric_cast(sizeof(uint32_t)); + uint32_t sizeOfUint16 = armnn::numeric_cast(sizeof(uint16_t)); uint32_t offset = 0; @@ -34,7 +32,7 @@ void PeriodicCounterCaptureCommandHandler::ParseData(const armnn::profiling::Pac { offset = 0; - uint64_t timestamp = profiling::ReadUint64(reinterpret_cast(packet.GetData()), offset); + uint64_t timestamp = arm::pipe::ReadUint64(reinterpret_cast(packet.GetData()), offset); if (m_FirstTimestamp == 0) // detect the first timestamp we receive. { @@ -59,11 +57,11 @@ void PeriodicCounterCaptureCommandHandler::ParseData(const armnn::profiling::Pac for (unsigned int pos = 0; pos < counters; ++pos) { counterIds.emplace_back( - profiling::ReadUint16(reinterpret_cast(packet.GetData()), offset)); + arm::pipe::ReadUint16(reinterpret_cast(packet.GetData()), offset)); offset += sizeOfUint16; counterValues.emplace_back( - profiling::ReadUint32(reinterpret_cast(packet.GetData()), offset)); + arm::pipe::ReadUint32(reinterpret_cast(packet.GetData()), offset)); offset += sizeOfUint32; } } @@ -74,7 +72,7 @@ void PeriodicCounterCaptureCommandHandler::ParseData(const armnn::profiling::Pac } } -void PeriodicCounterCaptureCommandHandler::operator()(const profiling::Packet& packet) +void PeriodicCounterCaptureCommandHandler::operator()(const arm::pipe::Packet& packet) { ParseData(packet); if (!m_QuietOperation) // Are we supposed to print to stdout? @@ -93,24 +91,24 @@ void PeriodicCounterCaptureCommandHandler::operator()(const profiling::Packet& p valueString.append(", "); } - body.append(profiling::CentreAlignFormatting(std::to_string(m_CounterCaptureValues.m_Timestamp), 10)); + body.append(arm::pipe::CentreAlignFormatting(std::to_string(m_CounterCaptureValues.m_Timestamp), 10)); body.append(" | "); - body.append(profiling::CentreAlignFormatting(std::to_string(m_CurrentPeriodValue), 13)); + body.append(arm::pipe::CentreAlignFormatting(std::to_string(m_CurrentPeriodValue), 13)); body.append(" | "); - body.append(profiling::CentreAlignFormatting(uidString, 10)); + body.append(arm::pipe::CentreAlignFormatting(uidString, 10)); body.append(" | "); - body.append(profiling::CentreAlignFormatting(valueString, 10)); + body.append(arm::pipe::CentreAlignFormatting(valueString, 10)); body.append("\n"); if (!m_HeaderPrinted) { - header.append(profiling::CentreAlignFormatting(" Timestamp", 11)); + header.append(arm::pipe::CentreAlignFormatting(" Timestamp", 11)); header.append(" | "); - header.append(profiling::CentreAlignFormatting("Period (us)", 13)); + header.append(arm::pipe::CentreAlignFormatting("Period (us)", 13)); header.append(" | "); - header.append(profiling::CentreAlignFormatting("UID's", static_cast(uidString.size()))); + header.append(arm::pipe::CentreAlignFormatting("UID's", static_cast(uidString.size()))); header.append(" | "); - header.append(profiling::CentreAlignFormatting("Values", 10)); + header.append(arm::pipe::CentreAlignFormatting("Values", 10)); header.append("\n"); std::cout << header; diff --git a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp index 478d0a6ca9..60a448c8ef 100644 --- a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp +++ b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp @@ -1,12 +1,12 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once -#include -#include +#include +#include #include @@ -23,7 +23,7 @@ struct CounterCaptureValues std::vector m_Values; }; -class PeriodicCounterCaptureCommandHandler : public profiling::CommandHandlerFunctor +class PeriodicCounterCaptureCommandHandler : public arm::pipe::CommandHandlerFunctor { public: @@ -41,14 +41,14 @@ public: , m_QuietOperation(quietOperation) {} - void operator()(const armnn::profiling::Packet& packet) override; + void operator()(const arm::pipe::Packet& packet) override; CounterCaptureValues m_CounterCaptureValues; uint64_t m_CurrentPeriodValue = 0; private: - void ParseData(const armnn::profiling::Packet& packet); + void ParseData(const arm::pipe::Packet& packet); uint64_t m_FirstTimestamp = 0, m_SecondTimestamp = 0; diff --git a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp b/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp index 2c2e71170a..43d686c73f 100644 --- a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp +++ b/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.cpp @@ -1,11 +1,11 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #include "PeriodicCounterSelectionResponseHandler.hpp" -#include +#include #include @@ -15,11 +15,11 @@ namespace armnn namespace gatordmock { -void PeriodicCounterSelectionResponseHandler::operator()(const profiling::Packet& packet) +void PeriodicCounterSelectionResponseHandler::operator()(const arm::pipe::Packet& packet) { if (!m_QuietOperation) // Are we supposed to print to stdout? { - uint32_t period = profiling::ReadUint32(reinterpret_cast(packet.GetData()), 0); + uint32_t period = arm::pipe::ReadUint32(reinterpret_cast(packet.GetData()), 0); uint32_t numCounters = 0; // First check if there are any counters mentioned. if(packet.GetLength() > 4) diff --git a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp b/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp index c075857816..46da688ae1 100644 --- a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp +++ b/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp @@ -1,11 +1,11 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once -#include -#include +#include +#include #include @@ -15,7 +15,7 @@ namespace armnn namespace gatordmock { -class PeriodicCounterSelectionResponseHandler : public profiling::CommandHandlerFunctor +class PeriodicCounterSelectionResponseHandler : public arm::pipe::CommandHandlerFunctor { public: @@ -33,7 +33,7 @@ public: , m_QuietOperation(quietOperation) {} - void operator()(const armnn::profiling::Packet& packet) override; + void operator()(const arm::pipe::Packet& packet) override; private: bool m_QuietOperation; diff --git a/tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp b/tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp index d97925cc15..e547e90798 100644 --- a/tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp +++ b/tests/profiling/gatordmock/StreamMetadataCommandHandler.cpp @@ -1,15 +1,14 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #include "StreamMetadataCommandHandler.hpp" -#include +#include #include - -using namespace armnn::profiling; +#include namespace armnn { @@ -17,7 +16,7 @@ namespace armnn namespace gatordmock { -void StreamMetadataCommandHandler::operator()(const Packet& packet) +void StreamMetadataCommandHandler::operator()(const arm::pipe::Packet& packet) { ParseData(packet); @@ -57,7 +56,7 @@ std::string ReadString(const unsigned char* buffer, unsigned int &offset) return stringPtr != nullptr ? std::string(stringPtr) : ""; } -void StreamMetadataCommandHandler::ParseData(const Packet &packet) +void StreamMetadataCommandHandler::ParseData(const arm::pipe::Packet &packet) { // Check that at least the packet contains the fixed-length fields if (packet.GetLength() < 80) @@ -73,23 +72,23 @@ void StreamMetadataCommandHandler::ParseData(const Packet &packet) unsigned int offset = 0; // Get the fixed-length fields - m_PipeMagic = ReadUint32(buffer, offset); + m_PipeMagic = arm::pipe::ReadUint32(buffer, offset); offset += uint32_t_size; - m_StreamMetadataVersion = ReadUint32(buffer, offset); + m_StreamMetadataVersion = arm::pipe::ReadUint32(buffer, offset); offset += uint32_t_size; - m_MaxDataLen = ReadUint32(buffer, offset); + m_MaxDataLen = arm::pipe::ReadUint32(buffer, offset); offset += uint32_t_size; - m_Pid = ReadUint32(buffer, offset); + m_Pid = arm::pipe::ReadUint32(buffer, offset); offset += uint32_t_size; - m_OffsetInfo = ReadUint32(buffer, offset); + m_OffsetInfo = arm::pipe::ReadUint32(buffer, offset); offset += uint32_t_size; - m_OffsetHwVersion = ReadUint32(buffer, offset); + m_OffsetHwVersion = arm::pipe::ReadUint32(buffer, offset); offset += uint32_t_size; - m_OffsetSwVersion = ReadUint32(buffer, offset); + m_OffsetSwVersion = arm::pipe::ReadUint32(buffer, offset); offset += uint32_t_size; - m_OffsetProcessName = ReadUint32(buffer, offset); + m_OffsetProcessName = arm::pipe::ReadUint32(buffer, offset); offset += uint32_t_size; - m_OffsetPacketVersionTable = ReadUint32(buffer, offset); + m_OffsetPacketVersionTable = arm::pipe::ReadUint32(buffer, offset); offset += uint32_t_size * 2; // Also skipping the reserved word (all zeros) // Get the string fields @@ -103,15 +102,15 @@ void StreamMetadataCommandHandler::ParseData(const Packet &packet) if (m_OffsetPacketVersionTable > 0) { offset = m_OffsetPacketVersionTable; - uint16_t packetEntries = ReadUint16(buffer, offset + uint16_t_size); + uint16_t packetEntries = arm::pipe::ReadUint16(buffer, offset + uint16_t_size); offset += uint32_t_size; // Also skipping the reserved bytes (all zeros) for (uint16_t i = 0; i < packetEntries; i++) { - uint16_t packetFamilyAndId = ReadUint16(buffer, offset + uint16_t_size); + uint16_t packetFamilyAndId = arm::pipe::ReadUint16(buffer, offset + uint16_t_size); uint16_t packetFamily = (packetFamilyAndId >> 10) & 0x003F; uint16_t packetId = (packetFamilyAndId >> 0) & 0x03FF; offset += uint32_t_size; // Also skipping the reserved bytes (all zeros) - uint32_t packetVersion = ReadUint32(buffer, offset); + uint32_t packetVersion = arm::pipe::ReadUint32(buffer, offset); offset += uint32_t_size; m_PacketVersionTable.push_back({ packetFamily, packetId, packetVersion }); diff --git a/tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp b/tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp index 4558345e67..ceb77d1b51 100644 --- a/tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp +++ b/tests/profiling/gatordmock/StreamMetadataCommandHandler.hpp @@ -1,12 +1,12 @@ // -// Copyright © 2019 Arm Ltd. All rights reserved. +// Copyright © 2019 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once -#include -#include +#include +#include #include @@ -23,7 +23,7 @@ struct PacketVersion uint32_t m_PacketVersion; }; -class StreamMetadataCommandHandler : public profiling::CommandHandlerFunctor +class StreamMetadataCommandHandler : public arm::pipe::CommandHandlerFunctor { public: @@ -41,10 +41,10 @@ public: , m_QuietOperation(quietOperation) {} - void operator()(const armnn::profiling::Packet& packet) override; + void operator()(const arm::pipe::Packet& packet) override; private: - void ParseData(const armnn::profiling::Packet& packet); + void ParseData(const arm::pipe::Packet& packet); uint32_t m_PipeMagic; uint32_t m_StreamMetadataVersion; diff --git a/tests/profiling/gatordmock/StubCommandHandler.hpp b/tests/profiling/gatordmock/StubCommandHandler.hpp index 450f90fd2b..50fb14b5de 100644 --- a/tests/profiling/gatordmock/StubCommandHandler.hpp +++ b/tests/profiling/gatordmock/StubCommandHandler.hpp @@ -1,11 +1,11 @@ // -// Copyright © 2020 Arm Ltd. All rights reserved. +// Copyright © 2020 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once -#include -#include +#include +#include #include @@ -15,7 +15,7 @@ namespace armnn namespace gatordmock { -class StubCommandHandler : public profiling::CommandHandlerFunctor +class StubCommandHandler : public arm::pipe::CommandHandlerFunctor { public: @@ -30,10 +30,10 @@ public: : CommandHandlerFunctor(familyId, packetId, version) {} - void operator()(const armnn::profiling::Packet& packet) override + void operator()(const arm::pipe::Packet& packet) override { //No op - IgnoreUnused(packet); + arm::pipe::IgnoreUnused(packet); } }; diff --git a/tests/profiling/gatordmock/tests/GatordMockTests.cpp b/tests/profiling/gatordmock/tests/GatordMockTests.cpp index e7eb0846c0..941e284928 100644 --- a/tests/profiling/gatordmock/tests/GatordMockTests.cpp +++ b/tests/profiling/gatordmock/tests/GatordMockTests.cpp @@ -3,16 +3,16 @@ // SPDX-License-Identifier: MIT // -#include -#include +#include +#include #include #include #include #include #include -#include -#include +#include +#include #include @@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(CounterCaptureHandlingTest) { using boost::numeric_cast; - profiling::PacketVersionResolver packetVersionResolver; + arm::pipe::PacketVersionResolver packetVersionResolver; // Data with timestamp, counter idx & counter values std::vector> indexValuePairs; @@ -91,8 +91,8 @@ BOOST_AUTO_TEST_CASE(CounterCaptureHandlingTest) uint32_t headerWord1 = packetVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue(); // Create packet to send through to the command functor - profiling::Packet packet1(headerWord1, dataLength, uniqueData1); - profiling::Packet packet2(headerWord1, dataLength, uniqueData2); + arm::pipe::Packet packet1(headerWord1, dataLength, uniqueData1); + arm::pipe::Packet packet2(headerWord1, dataLength, uniqueData2); gatordmock::PeriodicCounterCaptureCommandHandler commandHandler(0, 4, headerWord1, true); @@ -122,7 +122,7 @@ void WaitFor(std::function predicate, std::string errorMsg, uint32_t tim } } -void CheckTimelineDirectory(timelinedecoder::TimelineDirectoryCaptureCommandHandler& commandHandler) +void CheckTimelineDirectory(arm::pipe::TimelineDirectoryCaptureCommandHandler& commandHandler) { uint32_t uint8_t_size = sizeof(uint8_t); uint32_t uint32_t_size = sizeof(uint32_t); @@ -138,7 +138,7 @@ void CheckTimelineDirectory(timelinedecoder::TimelineDirectoryCaptureCommandHand sendTimelinePacket->SendTimelineMessageDirectoryPackage(); sendTimelinePacket->Commit(); - std::vector swTraceBufferMessages; + std::vector swTraceBufferMessages; unsigned int offset = uint32_t_size * 2; @@ -158,15 +158,15 @@ void CheckTimelineDirectory(timelinedecoder::TimelineDirectoryCaptureCommandHand offset += uint32_t_size; for(uint32_t i = 0; i < declarationSize; ++i) { - swTraceBufferMessages.push_back(profiling::ReadSwTraceMessage(packetBuffer->GetReadableData(), + swTraceBufferMessages.push_back(arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize())); } for(uint32_t index = 0; index < declarationSize; ++index) { - profiling::SwTraceMessage& bufferMessage = swTraceBufferMessages[index]; - profiling::SwTraceMessage& handlerMessage = commandHandler.m_SwTraceMessages[index]; + arm::pipe::SwTraceMessage& bufferMessage = swTraceBufferMessages[index]; + arm::pipe::SwTraceMessage& handlerMessage = commandHandler.m_SwTraceMessages[index]; BOOST_CHECK(bufferMessage.m_Name == handlerMessage.m_Name); BOOST_CHECK(bufferMessage.m_UiName == handlerMessage.m_UiName); @@ -186,7 +186,7 @@ void CheckTimelineDirectory(timelinedecoder::TimelineDirectoryCaptureCommandHand } } -void CheckTimelinePackets(timelinedecoder::TimelineDecoder& timelineDecoder) +void CheckTimelinePackets(arm::pipe::TimelineDecoder& timelineDecoder) { unsigned int i = 0; // Use a postfix increment to avoid changing indexes each time the packet gets updated. BOOST_CHECK(timelineDecoder.GetModel().m_Labels[i].m_Guid == profiling::LabelsAndEventClasses::NAME_GUID); @@ -246,9 +246,9 @@ BOOST_AUTO_TEST_CASE(GatorDMockEndToEnd) // Setup the mock service to bind to the UDS. std::string udsNamespace = "gatord_namespace"; - BOOST_CHECK_NO_THROW(armnnProfiling::ConnectionHandler connectionHandler(udsNamespace, false)); + BOOST_CHECK_NO_THROW(arm::pipe::ConnectionHandler connectionHandler(udsNamespace, false)); - armnnProfiling::ConnectionHandler connectionHandler(udsNamespace, false); + arm::pipe::ConnectionHandler connectionHandler(udsNamespace, false); // Enable the profiling service. armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; @@ -270,7 +270,7 @@ BOOST_AUTO_TEST_CASE(GatorDMockEndToEnd) // Connect the profiling service to the mock Gatord. gatordmock::GatordMockService mockService(std::move(basePipeServer), false); - timelinedecoder::TimelineDecoder& timelineDecoder = mockService.GetTimelineDecoder(); + arm::pipe::TimelineDecoder& timelineDecoder = mockService.GetTimelineDecoder(); profiling::DirectoryCaptureCommandHandler& directoryCaptureCommandHandler = mockService.GetDirectoryCaptureCommandHandler(); @@ -401,7 +401,7 @@ BOOST_AUTO_TEST_CASE(GatorDMockTimeLineActivation) // Setup the mock service to bind to the UDS. std::string udsNamespace = "gatord_namespace"; - armnnProfiling::ConnectionHandler connectionHandler(udsNamespace, false); + arm::pipe::ConnectionHandler connectionHandler(udsNamespace, false); armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; @@ -447,7 +447,7 @@ BOOST_AUTO_TEST_CASE(GatorDMockTimeLineActivation) WaitFor([&](){return mockService.GetDirectoryCaptureCommandHandler().ParsedCounterDirectory();}, "MockGatord did not receive counter directory packet"); - timelinedecoder::TimelineDecoder& timelineDecoder = mockService.GetTimelineDecoder(); + arm::pipe::TimelineDecoder& timelineDecoder = mockService.GetTimelineDecoder(); WaitFor([&](){return timelineDecoder.GetModel().m_EventClasses.size() >= 2;}, "MockGatord did not receive well known timeline labels"); -- cgit v1.2.1