From 0c8cb99db6dd8b1ea073ef7227b2872a3cb0b269 Mon Sep 17 00:00:00 2001 From: Finn Williams Date: Thu, 7 May 2020 10:38:15 +0100 Subject: IVGCVSW-4731 Move Packet.hpp to profiling/common/include * Refactor profiling cmake to fix inconsistencies/issues with includes Signed-off-by: Finn Williams Change-Id: I0836762d4c72e25754a28162ec54c8e332422a02 --- .../ActivateTimelineReportingCommandHandler.hpp | 7 +- src/profiling/CommandHandlerFunctor.hpp | 2 +- .../ConnectionAcknowledgedCommandHandler.hpp | 3 +- .../DeactivateTimelineReportingCommandHandler.hpp | 2 +- src/profiling/FileOnlyProfilingConnection.hpp | 2 +- src/profiling/IProfilingConnection.hpp | 2 +- src/profiling/Packet.hpp | 89 ---------------------- .../PerJobCounterSelectionCommandHandler.hpp | 2 +- src/profiling/PeriodicCounterCapture.hpp | 2 +- .../PeriodicCounterSelectionCommandHandler.hpp | 2 +- src/profiling/ProfilingUtils.hpp | 3 +- .../RequestCounterDirectoryCommandHandler.hpp | 2 +- src/profiling/test/PrintPacketHeaderHandler.hpp | 2 +- src/profiling/test/TestTimelinePacketHandler.hpp | 3 +- src/timelineDecoder/CMakeLists.txt | 29 ++++--- src/timelineDecoder/JSONTimelineDecoder.hpp | 2 +- .../TimelineCaptureCommandHandler.hpp | 2 +- src/timelineDecoder/TimelineDecoder.hpp | 3 +- .../TimelineDirectoryCaptureCommandHandler.hpp | 2 +- 19 files changed, 41 insertions(+), 120 deletions(-) delete mode 100644 src/profiling/Packet.hpp (limited to 'src') diff --git a/src/profiling/ActivateTimelineReportingCommandHandler.hpp b/src/profiling/ActivateTimelineReportingCommandHandler.hpp index ac11b46379..a0a2de0888 100644 --- a/src/profiling/ActivateTimelineReportingCommandHandler.hpp +++ b/src/profiling/ActivateTimelineReportingCommandHandler.hpp @@ -7,12 +7,15 @@ #include "CommandHandlerFunctor.hpp" #include "ProfilingStateMachine.hpp" -#include "Packet.hpp" #include "SendTimelinePacket.hpp" #include "IReportStructure.hpp" -#include "armnn/Optional.hpp" #include "INotifyBackends.hpp" +#include "armnn/Optional.hpp" + +#include "common/include/Packet.hpp" + + namespace armnn { diff --git a/src/profiling/CommandHandlerFunctor.hpp b/src/profiling/CommandHandlerFunctor.hpp index 743bb937c2..8096c41a3c 100644 --- a/src/profiling/CommandHandlerFunctor.hpp +++ b/src/profiling/CommandHandlerFunctor.hpp @@ -5,7 +5,7 @@ #pragma once -#include "Packet.hpp" +#include "common/include/Packet.hpp" #include diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp index 053d3c32fc..bcd1eed9cb 100644 --- a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp +++ b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp @@ -9,9 +9,8 @@ #include "CommandHandlerFunctor.hpp" #include "ISendCounterPacket.hpp" #include "armnn/profiling/ISendTimelinePacket.hpp" -#include "Packet.hpp" +#include "common/include/Packet.hpp" #include "ProfilingStateMachine.hpp" -#include namespace armnn { diff --git a/src/profiling/DeactivateTimelineReportingCommandHandler.hpp b/src/profiling/DeactivateTimelineReportingCommandHandler.hpp index e06bae836f..e9ce63db14 100644 --- a/src/profiling/DeactivateTimelineReportingCommandHandler.hpp +++ b/src/profiling/DeactivateTimelineReportingCommandHandler.hpp @@ -6,7 +6,7 @@ #pragma once #include "CommandHandlerFunctor.hpp" -#include "Packet.hpp" +#include "common/include/Packet.hpp" #include "ProfilingStateMachine.hpp" #include "INotifyBackends.hpp" diff --git a/src/profiling/FileOnlyProfilingConnection.hpp b/src/profiling/FileOnlyProfilingConnection.hpp index 466f4f1831..75db477b4f 100644 --- a/src/profiling/FileOnlyProfilingConnection.hpp +++ b/src/profiling/FileOnlyProfilingConnection.hpp @@ -8,7 +8,7 @@ #include #include "DirectoryCaptureCommandHandler.hpp" #include "IProfilingConnection.hpp" -#include "Packet.hpp" +#include "common/include/Packet.hpp" #include "ProfilingUtils.hpp" #include "Runtime.hpp" diff --git a/src/profiling/IProfilingConnection.hpp b/src/profiling/IProfilingConnection.hpp index 2a1c35f57e..2fc950e4e6 100644 --- a/src/profiling/IProfilingConnection.hpp +++ b/src/profiling/IProfilingConnection.hpp @@ -5,7 +5,7 @@ #pragma once -#include "Packet.hpp" +#include "common/include/Packet.hpp" #include #include diff --git a/src/profiling/Packet.hpp b/src/profiling/Packet.hpp deleted file mode 100644 index c1f2796804..0000000000 --- a/src/profiling/Packet.hpp +++ /dev/null @@ -1,89 +0,0 @@ -// -// Copyright © 2017 Arm Ltd. All rights reserved. -// SPDX-License-Identifier: MIT -// - -#pragma once - -#include - -#include - -namespace armnn -{ - -namespace profiling -{ - -class Packet -{ -public: - Packet() - : m_Header(0) - , m_Length(0) - , m_Data(nullptr) - {} - - Packet(uint32_t header) - : m_Header(header) - , m_Length(0) - , m_Data(nullptr) - { - m_PacketId = ((header >> 16) & 1023); - m_PacketFamily = (header >> 26); - } - - Packet(uint32_t header, uint32_t length, std::unique_ptr& data) - : m_Header(header) - , m_Length(length) - , m_Data(std::move(data)) - { - m_PacketId = ((header >> 16) & 1023); - m_PacketFamily = (header >> 26); - - if (length == 0 && m_Data != nullptr) - { - throw armnn::InvalidArgumentException("Data should be null when length is zero"); - } - } - - Packet(Packet&& other) - : m_Header(other.m_Header) - , m_PacketFamily(other.m_PacketFamily) - , m_PacketId(other.m_PacketId) - , m_Length(other.m_Length) - , m_Data(std::move(other.m_Data)) - { - other.m_Header = 0; - other.m_PacketFamily = 0; - other.m_PacketId = 0; - other.m_Length = 0; - } - - ~Packet() = default; - - Packet(const Packet& other) = delete; - Packet& operator=(const Packet&) = delete; - Packet& operator=(Packet&&) = default; - - uint32_t GetHeader() const { return m_Header; } - uint32_t GetPacketFamily() const { return m_PacketFamily; } - uint32_t GetPacketId() const { return m_PacketId; } - uint32_t GetPacketClass() const { return m_PacketId >> 3; } - uint32_t GetPacketType() const { return m_PacketId & 7; } - uint32_t GetLength() const { return m_Length; } - const unsigned char* GetData() const { return m_Data.get(); } - - bool IsEmpty() { return m_Header == 0 && m_Length == 0; } - -private: - uint32_t m_Header; - uint32_t m_PacketFamily; - uint32_t m_PacketId; - uint32_t m_Length; - std::unique_ptr m_Data; -}; - -} // namespace profiling - -} // namespace armnn diff --git a/src/profiling/PerJobCounterSelectionCommandHandler.hpp b/src/profiling/PerJobCounterSelectionCommandHandler.hpp index 738a4762f9..16cb02a285 100644 --- a/src/profiling/PerJobCounterSelectionCommandHandler.hpp +++ b/src/profiling/PerJobCounterSelectionCommandHandler.hpp @@ -5,7 +5,7 @@ #pragma once -#include "Packet.hpp" +#include "common/include/Packet.hpp" #include "CommandHandlerFunctor.hpp" #include "ProfilingStateMachine.hpp" diff --git a/src/profiling/PeriodicCounterCapture.hpp b/src/profiling/PeriodicCounterCapture.hpp index 51ac273860..796c494480 100644 --- a/src/profiling/PeriodicCounterCapture.hpp +++ b/src/profiling/PeriodicCounterCapture.hpp @@ -7,7 +7,7 @@ #include "IPeriodicCounterCapture.hpp" #include "Holder.hpp" -#include "Packet.hpp" +#include "common/include/Packet.hpp" #include "SendCounterPacket.hpp" #include "ICounterValues.hpp" #include "CounterIdMap.hpp" diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp index b59d84cffa..8cf5595920 100644 --- a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp +++ b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp @@ -6,7 +6,7 @@ #pragma once #include "CounterIdMap.hpp" -#include "Packet.hpp" +#include "common/include/Packet.hpp" #include "CommandHandlerFunctor.hpp" #include "Holder.hpp" #include "ProfilingStateMachine.hpp" diff --git a/src/profiling/ProfilingUtils.hpp b/src/profiling/ProfilingUtils.hpp index e2ffb24bf9..127534a593 100644 --- a/src/profiling/ProfilingUtils.hpp +++ b/src/profiling/ProfilingUtils.hpp @@ -10,7 +10,8 @@ #include "ICounterDirectory.hpp" #include "IPacketBuffer.hpp" -#include "Packet.hpp" + +#include "common/include/Packet.hpp" #include diff --git a/src/profiling/RequestCounterDirectoryCommandHandler.hpp b/src/profiling/RequestCounterDirectoryCommandHandler.hpp index 9ceca3f643..ea60ca83e4 100644 --- a/src/profiling/RequestCounterDirectoryCommandHandler.hpp +++ b/src/profiling/RequestCounterDirectoryCommandHandler.hpp @@ -8,7 +8,7 @@ #include "CommandHandlerFunctor.hpp" #include "ISendCounterPacket.hpp" #include "armnn/profiling/ISendTimelinePacket.hpp" -#include "Packet.hpp" +#include "common/include/Packet.hpp" #include "ProfilingStateMachine.hpp" namespace armnn diff --git a/src/profiling/test/PrintPacketHeaderHandler.hpp b/src/profiling/test/PrintPacketHeaderHandler.hpp index 3cd5921e51..6564f3cea5 100644 --- a/src/profiling/test/PrintPacketHeaderHandler.hpp +++ b/src/profiling/test/PrintPacketHeaderHandler.hpp @@ -6,7 +6,7 @@ #pragma once #include -#include "Packet.hpp" +#include namespace armnn { diff --git a/src/profiling/test/TestTimelinePacketHandler.hpp b/src/profiling/test/TestTimelinePacketHandler.hpp index 2902e5f89c..67395254fc 100644 --- a/src/profiling/test/TestTimelinePacketHandler.hpp +++ b/src/profiling/test/TestTimelinePacketHandler.hpp @@ -7,7 +7,8 @@ #include #include -#include "Packet.hpp" +#include + #include "ProfilingUtils.hpp" #include "TimelineCaptureCommandHandler.hpp" #include "TimelineDirectoryCaptureCommandHandler.hpp" diff --git a/src/timelineDecoder/CMakeLists.txt b/src/timelineDecoder/CMakeLists.txt index 12fe2a0f04..f844325b1d 100644 --- a/src/timelineDecoder/CMakeLists.txt +++ b/src/timelineDecoder/CMakeLists.txt @@ -6,20 +6,25 @@ if(BUILD_TIMELINE_DECODER) set(timelineDecoder_sources) list(APPEND timelineDecoder_sources - ../../include/armnn/profiling/ITimelineDecoder.hpp - TimelineCaptureCommandHandler.cpp - TimelineCaptureCommandHandler.hpp - JSONTimelineDecoder.cpp - JSONTimelineDecoder.hpp - TimelineDecoder.cpp - TimelineDecoder.hpp - TimelineDirectoryCaptureCommandHandler.cpp - TimelineDirectoryCaptureCommandHandler.hpp - ) - - include_directories(../timelineDecoder ../profiling) + ${PROJECT_SOURCE_DIR}/include/armnn/profiling/ITimelineDecoder.hpp + TimelineCaptureCommandHandler.cpp + TimelineCaptureCommandHandler.hpp + JSONTimelineDecoder.cpp + JSONTimelineDecoder.hpp + TimelineDecoder.cpp + TimelineDecoder.hpp + TimelineDirectoryCaptureCommandHandler.cpp + TimelineDirectoryCaptureCommandHandler.hpp) + + include_directories(${PROJECT_SOURCE_DIR}/src/profiling + ${PROJECT_SOURCE_DIR}/profiling/common/include) + + if(BUILD_UNIT_TESTS) + target_include_directories(UnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/timelineDecoder) + endif() add_library_ex(timelineDecoder SHARED ${timelineDecoder_sources}) + set_target_properties(timelineDecoder PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) set_target_properties(timelineDecoder PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) diff --git a/src/timelineDecoder/JSONTimelineDecoder.hpp b/src/timelineDecoder/JSONTimelineDecoder.hpp index c4e085587e..38d698387a 100644 --- a/src/timelineDecoder/JSONTimelineDecoder.hpp +++ b/src/timelineDecoder/JSONTimelineDecoder.hpp @@ -5,7 +5,7 @@ #pragma once -#include "armnn/profiling/ITimelineDecoder.hpp" +#include #include #include diff --git a/src/timelineDecoder/TimelineCaptureCommandHandler.hpp b/src/timelineDecoder/TimelineCaptureCommandHandler.hpp index e143b5f6e5..6c0c57ae69 100644 --- a/src/timelineDecoder/TimelineCaptureCommandHandler.hpp +++ b/src/timelineDecoder/TimelineCaptureCommandHandler.hpp @@ -5,7 +5,7 @@ #pragma once -#include "armnn/profiling/ITimelineDecoder.hpp" +#include #include #include diff --git a/src/timelineDecoder/TimelineDecoder.hpp b/src/timelineDecoder/TimelineDecoder.hpp index c6d1e4ee0a..2efdc4483b 100644 --- a/src/timelineDecoder/TimelineDecoder.hpp +++ b/src/timelineDecoder/TimelineDecoder.hpp @@ -4,7 +4,8 @@ // #pragma once -#include "armnn/profiling/ITimelineDecoder.hpp" +#include + #include namespace armnn diff --git a/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp b/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp index a22a5d9f87..2879052340 100644 --- a/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp +++ b/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp @@ -5,8 +5,8 @@ #pragma once +#include "TimelineCaptureCommandHandler.hpp" -#include #include #include #include -- cgit v1.2.1