LOCAL_SRC_FILES := \
$(ARMNN_BACKEND_SOURCES) \
+ profiling/common/src/CommandHandlerFunctor.cpp \
+ profiling/common/src/CommandHandlerKey.cpp \
+ profiling/common/src/CommandHandlerRegistry.cpp \
+ profiling/common/src/CommonProfilingUtils.cpp \
profiling/common/src/NetworkSockets.cpp \
+ profiling/common/src/PacketVersionResolver.cpp \
+ profiling/common/src/SwTrace.cpp \
+ profiling/server/src/timelineDecoder/TimelineCaptureCommandHandler.cpp \
+ profiling/server/src/timelineDecoder/TimelineDecoder.cpp \
+ profiling/server/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp \
src/armnn/BackendHelper.cpp \
src/armnn/BackendRegistry.cpp \
src/armnn/Descriptors.cpp \
src/profiling/ActivateTimelineReportingCommandHandler.cpp \
src/profiling/BufferManager.cpp \
src/profiling/CommandHandler.cpp \
- src/profiling/CommandHandlerFunctor.cpp \
- src/profiling/CommandHandlerKey.cpp \
- src/profiling/CommandHandlerRegistry.cpp \
src/profiling/ConnectionAcknowledgedCommandHandler.cpp \
src/profiling/CounterDirectory.cpp \
src/profiling/CounterIdMap.cpp \
src/profiling/Holder.cpp \
src/profiling/LabelsAndEventClasses.cpp \
src/profiling/PacketBuffer.cpp \
- src/profiling/PacketVersionResolver.cpp \
src/profiling/PeriodicCounterCapture.cpp \
src/profiling/PeriodicCounterSelectionCommandHandler.cpp \
src/profiling/PerJobCounterSelectionCommandHandler.cpp \
src/profiling/SocketProfilingConnection.cpp \
src/profiling/TimelinePacketWriterFactory.cpp \
src/profiling/TimelineUtilityMethods.cpp \
- src/profiling/backends/BackendProfiling.cpp \
- src/timelineDecoder/TimelineCaptureCommandHandler.cpp \
- src/timelineDecoder/TimelineDecoder.cpp \
- src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
+ src/profiling/backends/BackendProfiling.cpp
LOCAL_STATIC_LIBRARIES := \
arm_compute_library \
#
-# Copyright © 2020 Arm Ltd. and Contributors All rights reserved.
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
# Copyright 2020 NXP
# SPDX-License-Identifier: MIT
#
src/armnnUtils/Threads.hpp
src/armnnUtils/Threads.cpp
src/armnnUtils/Transpose.cpp
- src/armnnUtils/WindowsWrapper.hpp
)
add_library_ex(armnnUtils STATIC ${armnnUtils_sources})
include/armnn/utility/NumericCast.hpp
include/armnn/utility/PolymorphicDowncast.hpp
include/armnn/utility/StringUtils.hpp
- profiling/common/include/Packet.hpp
- profiling/common/include/ProfilingException.hpp
- profiling/common/include/SocketConnectionException.hpp
- profiling/common/include/Constants.hpp
- profiling/common/include/NetworkSockets.hpp
- profiling/common/src/NetworkSockets.cpp
src/armnn/layers/LayerCloneBase.hpp
src/armnn/layers/LayerWithParameters.hpp
src/armnn/layers/ActivationLayer.hpp
src/profiling/BufferManager.hpp
src/profiling/CommandHandler.cpp
src/profiling/CommandHandler.hpp
- src/profiling/CommandHandlerFunctor.cpp
- src/profiling/CommandHandlerFunctor.hpp
- src/profiling/CommandHandlerKey.cpp
- src/profiling/CommandHandlerKey.hpp
- src/profiling/CommandHandlerRegistry.cpp
- src/profiling/CommandHandlerRegistry.hpp
src/profiling/ConnectionAcknowledgedCommandHandler.cpp
src/profiling/ConnectionAcknowledgedCommandHandler.hpp
src/profiling/CounterDirectory.cpp
src/profiling/DeactivateTimelineReportingCommandHandler.hpp
src/profiling/DirectoryCaptureCommandHandler.cpp
src/profiling/DirectoryCaptureCommandHandler.hpp
- src/profiling/EncodeVersion.hpp
src/profiling/FileOnlyProfilingConnection.cpp
src/profiling/FileOnlyProfilingConnection.hpp
src/profiling/Holder.cpp
src/profiling/NullProfilingConnection.hpp
src/profiling/PacketBuffer.cpp
src/profiling/PacketBuffer.hpp
- src/profiling/PacketVersionResolver.cpp
- src/profiling/PacketVersionResolver.hpp
src/profiling/PeriodicCounterCapture.hpp
src/profiling/PeriodicCounterCapture.cpp
src/profiling/PeriodicCounterSelectionCommandHandler.cpp
third-party/fmt/core.h
third-party/fmt/format.h
third-party/fmt/format-inl.h
+ third-party/fmt/src/format.cc
third-party/ghc/filesystem.hpp
third-party/half/half.hpp
)
target_include_directories(armnn PRIVATE src/profiling)
target_include_directories(armnn PRIVATE profiling/common/include)
-target_link_libraries(armnn armnnUtils)
+target_link_libraries(armnn armnnUtils pipeCommon)
target_link_libraries(armnn ${CMAKE_DL_LIBS})
if ("${CMAKE_SYSTEM_NAME}" STREQUAL Windows)
if(BUILD_TIMELINE_DECODER)
list(APPEND unittest_sources
src/timelineDecoder/tests/JSONTimelineDecoderTests.cpp
- src/timelineDecoder/tests/TimelineTests.cpp
+ profiling/server/src/timelineDecoder/tests/TimelineTests.cpp
)
endif()
if(BUILD_TIMELINE_DECODER)
target_link_libraries(UnitTests timelineDecoder)
+ target_link_libraries(UnitTests jsonTimelineDecoder)
endif()
if(BUILD_TF_LITE_PARSER)
endif()
if(BUILD_TIMELINE_DECODER)
+ add_subdirectory(profiling/server/src/timelineDecoder)
+ add_subdirectory(profiling/common/src)
add_subdirectory(src/timelineDecoder)
endif()
#
-# Copyright © 2020 Arm Ltd. All rights reserved.
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
# Copyright 2020 NXP
# SPDX-License-Identifier: MIT
#
option(BUILD_BASE_PIPE_SERVER "Build the server to handle external profiling pipe traffic" ON)
option(BUILD_PYTHON_WHL "Build Python wheel package" OFF)
option(BUILD_PYTHON_SRC "Build Python source package" OFF)
+option(BUILD_STATIC_PIPE_LIBS "Build Static PIPE libraries" OFF)
+option(BUILD_PIPE_ONLY "Build the PIPE libraries only" OFF)
include(SelectLibraryConfigurations)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
-# Boost
-if(SHARED_BOOST)
+if (NOT BUILD_PIPE_ONLY)
+ # Boost
+ message(STATUS "Finding Boost")
+ if(SHARED_BOOST)
add_definitions(-DBOOST_ALL_DYN_LINK)
set(Boost_USE_STATIC_LIBS OFF)
-else()
+ else()
set(Boost_USE_STATIC_LIBS ON)
+ endif()
+ add_definitions("-DBOOST_ALL_NO_LIB") # Turn off auto-linking as we specify the libs manually
+ find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework filesystem system program_options)
+ include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
+ link_directories(${Boost_LIBRARY_DIRS})
endif()
-add_definitions("-DBOOST_ALL_NO_LIB") # Turn off auto-linking as we specify the libs manually
-find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework filesystem system program_options)
-include_directories(SYSTEM "${Boost_INCLUDE_DIRS}")
-link_directories(${Boost_LIBRARY_DIRS})
-# cxxopts (Alternative to boost::program_options)
-find_path(CXXOPTS_INCLUDE cxxopts/cxxopts.hpp PATHS third-party)
-include_directories(SYSTEM "${CXXOPTS_INCLUDE}")
+if (NOT BUILD_PIPE_ONLY)
+ # cxxopts (Alternative to boost::program_options)
+ find_path(CXXOPTS_INCLUDE cxxopts/cxxopts.hpp PATHS third-party)
+ include_directories(SYSTEM "${CXXOPTS_INCLUDE}")
+endif()
-# ghc (Alternative to boost::filesystem)
-find_path(GHC_INCLUDE ghc/filesystem.hpp PATHS third-party)
-include_directories(SYSTEM "${GHC_INCLUDE}")
+if (NOT BUILD_PIPE_ONLY)
+ # ghc (Alternative to boost::filesystem)
+ find_path(GHC_INCLUDE ghc/filesystem.hpp PATHS third-party)
+ include_directories(SYSTEM "${GHC_INCLUDE}")
+endif()
# pthread
find_package (Threads)
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include <memory>
#include <vector>
+// forward declare to prevent a circular dependency
+namespace arm
+{
+namespace pipe
+{
+ class Packet;
+} // namespace pipe
+} // namespace arm
+
namespace armnn
{
LeWire
};
-// forward declare to prevent a circular dependency
-class Packet;
-
// the handlers need to be able to do two
// things to service the FileOnlyProfilingConnection
// and any other implementation of IProfilingConnection
virtual void SetEndianess(const TargetEndianness& endianness) = 0;
- virtual void ReturnPacket(Packet& packet) = 0;
+ virtual void ReturnPacket(arm::pipe::Packet& packet) = 0;
virtual void Close() = 0;
};
virtual std::vector<uint32_t> GetHeadersAccepted() = 0;
/// process the packet
- virtual void HandlePacket(const Packet& packet) = 0;
+ virtual void HandlePacket(const arm::pipe::Packet& packet) = 0;
/// Set a profiling connection on the handler. Only need to implement this
/// function if the handler will be writing data back to the profiled application.
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
--- /dev/null
+#
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+# SPDX-License-Identifier: MIT
+#
+cmake_minimum_required (VERSION 3.0.2) # 3.0.2 required for return() statement used in AddDllCopyCommands.cmake
+project(pipe)
+
+set(additional_cmake_files)
+list(APPEND additional_cmake_files
+ ../cmake/ArmnnVersion.cmake
+ ../cmake/Utils.cmake
+ ../cmake/GlobalConfig.cmake
+ ../cmake/AddDllCopyCommands.cmake)
+
+foreach(cmake_file ${additional_cmake_files})
+ include(${cmake_file})
+endforeach()
+
+# Include the additional cmake files in their own target so that they will appear nicely in IDEs
+add_custom_target(AdditionalCMakeFiles SOURCES ${additional_cmake_files})
+
+include(GNUInstallDirs)
+
+include_directories(SYSTEM common/include)
+include_directories(SYSTEM ${PROJECT_SOURCE_DIR})
+
+set(BUILD_UNIT_TESTS 0)
+
+if(BUILD_TIMELINE_DECODER)
+ add_subdirectory(server/src/timelineDecoder)
+ add_subdirectory(common/src)
+endif()
+
+if(BUILD_BASE_PIPE_SERVER)
+ add_subdirectory(server/src/basePipeServer)
+endif()
--- /dev/null
+#!/bin/bash
+#
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+# SPDX-License-Identifier: MIT
+#
+
+SOURCE="${BASH_SOURCE[0]}"
+while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
+ TARGET="$(readlink "$SOURCE")"
+ if [[ $TARGET == /* ]]; then
+ # "SOURCE '$SOURCE' is an absolute symlink to '$TARGET'"
+ SOURCE="$TARGET"
+ else
+ DIR="$( dirname "$SOURCE" )"
+ # "SOURCE '$SOURCE' is a relative symlink to '$TARGET' (relative to '$DIR')"
+ SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
+ fi
+done
+RDIR="$( dirname "$SOURCE" )"
+DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
+
+CMD=$( basename $0 )
+
+usage() {
+ echo "Usage: $CMD [options]"
+ echo "Options: -t(type) <Debug or Release>"
+ echo " -c(lean) build"
+ echo " -s(tatic libraries) <1 or 0>"
+ echo " -w(indows) build"
+ exit 1
+}
+# defaults
+TYPE=Release
+CLEAN=0
+STATIC=0
+WINDOWS=0
+
+# Parse the command line
+while getopts "whct:s:" opt; do
+ case "$opt" in
+ h|\?) usage;;
+ t) TYPE=$OPTARG;;
+ c) CLEAN=1;;
+ s) STATIC=$OPTARG;;
+ w) WINDOWS=1;;
+ esac
+done
+shift $((OPTIND - 1))
+
+if [ $CLEAN == 1 ]; then
+ echo "removing ${DIR}/build"
+ rm -rf ${DIR}/build
+fi
+
+BUILD_DIR="build"
+[ -d build ] || mkdir build
+echo $WINDOWS
+if [ "$WINDOWS" -eq "1" ]; then
+ echo "doing windows"
+ cd $BUILD_DIR
+ [ -d windows ] || mkdir windows
+ BUILD_DIR=$BUILD_DIR/windows
+ cd $DIR
+fi
+# lower case TYPE in a posix compliant manner
+LC_TYPE=$(echo "$TYPE" | tr '[:upper:]' '[:lower:]')
+if [ ${LC_TYPE} == "debug" ]; then
+ DEBUGDIR=($DIR/$BUILD_DIR/debug)
+ [ -d $DEBUGDIR ] || (cd ${BUILD_DIR} && mkdir debug && cd ..)
+ BUILD_DIR=$DEBUGDIR
+else
+ RELEASEDIR=($DIR/$BUILD_DIR/release)
+ [ -d $RELEASEDIR ] || (cd ${BUILD_DIR} && mkdir release && cd ..)
+ BUILD_DIR=$RELEASEDIR
+fi
+
+echo "Build Directory: ${BUILD_DIR}"
+
+CMAKE=cmake
+CMARGS="-DCMAKE_BUILD_TYPE=$TYPE \
+ -DBUILD_STATIC_PIPE_LIBS=$STATIC \
+ -DBUILD_PIPE_ONLY=1"
+if [ "$WINDOWS" -eq "1" ]; then
+ CMARGS="$CMARGS \
+ -DCMAKE_TOOLCHAIN_FILE=${DIR}/toolchain-x86-ubuntu-mingw64.cmake"
+fi
+MAKE=make
+
+cd ${BUILD_DIR}
+pwd
+( eval $CMAKE $CMARGS $DIR && eval ${MAKE} $MAKEFLAGS )
--- /dev/null
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <cassert>
+
+namespace arm
+{
+
+namespace pipe
+{
+
+#ifndef NDEBUG
+# define ARM_PIPE_ASSERT(COND) assert(COND)
+# define ARM_PIPE_ASSERT_MSG(COND, MSG) assert((COND) && MSG)
+#else
+# define ARM_PIPE_ASSERT(COND)
+# define ARM_PIPE_ASSERT_MSG(COND, MSG)
+#endif
+} // namespace pipe
+} //namespace arm
\ No newline at end of file
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include <Packet.hpp>
-
-#include <armnn/utility/IgnoreUnused.hpp>
-
#include <cstdint>
-namespace armnn
+namespace arm
{
-namespace profiling
+namespace pipe
{
class CommandHandlerFunctor
uint32_t m_Version;
};
-} // namespace profiling
+} // namespace pipe
-} // namespace armnn
+} // namespace arm
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include <cstdint>
-namespace armnn
+namespace arm
{
-namespace profiling
+namespace pipe
{
class CommandHandlerKey
uint32_t m_Version;
};
-} // namespace profiling
+} // namespace pipe
-} // namespace armnn
+} // namespace arm
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "CommandHandlerFunctor.hpp"
#include "CommandHandlerKey.hpp"
-#include <boost/functional/hash.hpp>
-
+#include <functional>
#include <unordered_map>
-namespace armnn
+namespace arm
{
-namespace profiling
+namespace pipe
{
struct CommandHandlerHash
std::size_t operator() (const CommandHandlerKey& commandHandlerKey) const
{
std::size_t seed = 0;
- boost::hash_combine(seed, commandHandlerKey.GetPacketId());
- boost::hash_combine(seed, commandHandlerKey.GetVersion());
+ std::hash<uint32_t> hasher;
+ seed ^= hasher(commandHandlerKey.GetPacketId()) + 0x9e3779b9 + (seed<<6) + (seed>>2);
+ seed ^= hasher(commandHandlerKey.GetVersion()) + 0x9e3779b9 + (seed<<6) + (seed>>2);
return seed;
}
};
std::unordered_map<CommandHandlerKey, CommandHandlerFunctor*, CommandHandlerHash> registry;
};
-} // namespace profiling
+} // namespace pipe
-} // namespace armnn
+} // namespace arm
--- /dev/null
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+#pragma once
+
+#include <cstdint>
+#include <string>
+
+namespace arm
+{
+
+namespace pipe
+{
+void ReadBytes(const unsigned char* buffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[]);
+
+uint64_t ReadUint64(unsigned const char* buffer, unsigned int offset);
+
+uint32_t ReadUint32(unsigned const char* buffer, unsigned int offset);
+
+uint16_t ReadUint16(unsigned const char* buffer, unsigned int offset);
+
+uint8_t ReadUint8(unsigned const char* buffer, unsigned int offset);
+
+void WriteBytes(unsigned char* buffer, unsigned int offset, const void* value, unsigned int valueSize);
+
+void WriteUint64(unsigned char* buffer, unsigned int offset, uint64_t value);
+
+void WriteUint32(unsigned char* buffer, unsigned int offset, uint32_t value);
+
+void WriteUint16(unsigned char* buffer, unsigned int offset, uint16_t value);
+
+void WriteUint8(unsigned char* buffer, unsigned int offset, uint8_t value);
+
+std::string CentreAlignFormatting(const std::string& stringToPass, const int spacingWidth);
+
+} // namespace pipe
+} // namespace arm
\ No newline at end of file
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-namespace armnnProfiling
+namespace arm
+{
+
+namespace pipe
{
static const unsigned int PIPE_MAGIC = 0x45495434;
-}
\ No newline at end of file
+} // namespace pipe
+} // namespace arm
\ No newline at end of file
--- /dev/null
+//
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#if __GNUC__
+# define ARM_PIPE_NO_CONVERSION_WARN_BEGIN \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wconversion\"") \
+ _Pragma("GCC diagnostic ignored \"-Wsign-conversion\"")
+
+# define ARM_PIPE_NO_CONVERSION_WARN_END \
+ _Pragma("GCC diagnostic pop")
+
+#elif __clang__
+# define ARM_PIPE_NO_CONVERSION_WARN_BEGIN \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wconversion\"") \
+ _Pragma("clang diagnostic ignored \"-Wsign-conversion\"")
+
+# define ARM_PIPE_NO_CONVERSION_WARN_END \
+ _Pragma("clang diagnostic pop")
+
+#elif defined (_MSC_VER)
+# define ARM_PIPE_NO_CONVERSION_WARN_BEGIN \
+ __pragma(warning( push )) \
+ __pragma(warning(disable : 4101)) \
+ __pragma(warning(disable : 4267))
+
+# define ARM_PIPE_NO_CONVERSION_WARN_END \
+ __pragma(warning( pop ))
+
+#else
+# define ARM_PIPE_NO_CONVERSION_WARN_BEGIN
+# define ARM_PIPE_NO_CONVERSION_WARN_END
+#endif
+
+#define ARM_PIPE_SUPRESS_CONVERSION_WARNING(func) \
+ARM_PIPE_NO_CONVERSION_WARN_BEGIN \
+func; \
+ARM_PIPE_NO_CONVERSION_WARN_END
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include <ostream>
#include <sstream>
-namespace armnn
+namespace arm
{
-namespace profiling
+namespace pipe
{
constexpr inline uint32_t EncodeVersion(uint32_t major, uint32_t minor, uint32_t patch)
return os;
}
-} // namespace profiling
+} // namespace pipe
-} // namespace armnn
+} // namespace arm
--- /dev/null
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+namespace arm
+{
+
+namespace pipe
+{
+// Utility function to selectively silence unused variable compiler warnings
+
+template<typename ... Ts>
+inline void IgnoreUnused(Ts&&...){}
+} //namespace pipe
+} //namespace arm
\ No newline at end of file
--- /dev/null
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <iostream>
+#include <memory>
+#include <sstream>
+#include <vector>
+
+namespace arm
+{
+
+namespace pipe
+{
+
+enum class LogSeverity
+{
+ Trace,
+ Debug,
+ Info,
+ Warning,
+ Error,
+ Fatal
+};
+
+inline std::string LevelToString(LogSeverity level)
+{
+ switch(level)
+ {
+ case LogSeverity::Trace:
+ return "Trace";
+ case LogSeverity::Debug:
+ return "Debug";
+ case LogSeverity::Info:
+ return "Info";
+ case LogSeverity::Warning:
+ return "Warning";
+ case LogSeverity::Error:
+ return "Error";
+ case LogSeverity::Fatal:
+ return "Fatal";
+ default:
+ return "Log";
+ }
+}
+
+class LogSink
+{
+public:
+ virtual ~LogSink(){};
+
+ virtual void Consume(const std::string&) = 0;
+private:
+
+};
+
+class StandardOutputSink : public LogSink
+{
+public:
+ void Consume(const std::string& s) override
+ {
+ std::cout << s << std::endl;
+ }
+};
+
+struct ScopedRecord
+{
+ ScopedRecord(const std::vector<std::shared_ptr<LogSink>>& sinks, LogSeverity level, bool enabled)
+ : m_LogSinks(sinks)
+ , m_Enabled(enabled)
+ {
+ if (enabled)
+ {
+ m_Os << LevelToString(level) << ": ";
+ }
+ }
+
+ ~ScopedRecord()
+ {
+ if (m_Enabled)
+ {
+ for (auto sink : m_LogSinks)
+ {
+ if (sink)
+ {
+ sink->Consume(m_Os.str());
+ }
+ }
+ }
+ }
+
+ ScopedRecord(const ScopedRecord&) = delete;
+ ScopedRecord& operator=(const ScopedRecord&) = delete;
+ ScopedRecord& operator=(ScopedRecord&&) = delete;
+
+ ScopedRecord(ScopedRecord&& other) = default;
+
+ template<typename Streamable>
+ ScopedRecord& operator<<(const Streamable& s)
+ {
+ if (m_Enabled)
+ {
+ m_Os << s;
+ }
+ return (*this);
+ }
+
+private:
+ const std::vector<std::shared_ptr<LogSink>>& m_LogSinks;
+ std::ostringstream m_Os;
+ bool m_Enabled;
+};
+
+template<LogSeverity Level>
+class SimpleLogger
+{
+public:
+ SimpleLogger()
+ : m_Sinks{std::make_shared<StandardOutputSink>()}
+ , m_Enable(true)
+ {
+ }
+
+ static SimpleLogger& Get()
+ {
+ static SimpleLogger<Level> logger;
+ return logger;
+ }
+
+ void Enable(bool enable = true)
+ {
+ m_Enable = enable;
+ }
+
+ ScopedRecord StartNewRecord()
+ {
+ ScopedRecord record(m_Sinks, Level, m_Enable);
+ return record;
+ }
+
+ void RemoveAllSinks()
+ {
+ m_Sinks.clear();
+ }
+
+ void AddSink(std::shared_ptr<LogSink> sink)
+ {
+ m_Sinks.push_back(sink);
+ }
+private:
+ std::vector<std::shared_ptr<LogSink>> m_Sinks;
+ bool m_Enable;
+};
+
+void SetLogFilter(LogSeverity level);
+
+void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured);
+
+enum class BoostLogSeverityMapping
+{
+ trace,
+ debug,
+ info,
+ warning,
+ error,
+ fatal
+};
+
+constexpr LogSeverity ConvertLogSeverity(BoostLogSeverityMapping severity)
+{
+ return static_cast<LogSeverity>(severity);
+}
+
+
+#define ARM_PIPE_LOG(severity) \
+ arm::pipe::SimpleLogger<ConvertLogSeverity(arm::pipe::BoostLogSeverityMapping::severity)>::Get().StartNewRecord()
+
+} // namespace pipe
+} // namespace arm
#include <WindowsWrapper.hpp>
#include <winsock2.h>
#include <afunix.h>
+#elif defined(__MINGW32__)
+#include <WindowsWrapper.hpp>
+#include <winsock2.h>
#endif
-namespace armnnUtils
+namespace arm
{
-namespace Sockets
+namespace pipe
{
#if defined(__unix__)
using socklen_t = int;
#define SOCK_CLOEXEC 0
+#elif defined(__MINGW32__)
+
+using Socket = SOCKET;
+using PollFd = WSAPOLLFD;
+using nfds_t = int;
+using socklen_t = int;
+#define SOCK_CLOEXEC 0
+
#endif
/// Performs any required one-time setup.
Socket Accept(Socket s, sockaddr* addr, socklen_t* addrlen, int flags);
-}
-}
+} // namespace arm
+} // namespace pipe
--- /dev/null
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include "Assert.hpp"
+
+#include <type_traits>
+#include <limits>
+
+namespace arm
+{
+
+namespace pipe
+{
+
+#if !defined(NDEBUG) || defined(ARM_PIPE_NUMERIC_CAST_TESTABLE)
+#define ENABLE_NUMERIC_CAST_CHECKS 1
+#else
+#define ENABLE_NUMERIC_CAST_CHECKS 0
+#endif
+
+#if defined(ARM_PIPE_NUMERIC_CAST_TESTABLE)
+# define ARM_PIPE_NUMERIC_CAST_CHECK(cond, msg) ConditionalThrow<std::bad_cast>(cond)
+#else
+# define ARM_PIPE_NUMERIC_CAST_CHECK(cond, msg) ARM_PIPE_ASSERT_MSG(cond, msg)
+#endif
+
+template<typename Dest, typename Source>
+typename std::enable_if_t<
+ std::is_unsigned<Source>::value &&
+ std::is_unsigned<Dest>::value
+ , Dest>
+numeric_cast(Source source)
+{
+#if ENABLE_NUMERIC_CAST_CHECKS
+ if (source > std::numeric_limits<Dest>::max())
+ {
+ ARM_PIPE_NUMERIC_CAST_CHECK(false, "numeric_cast failed casting unsigned type to "
+ "narrower unsigned type. Overflow detected.");
+ }
+#endif // ENABLE_NUMERIC_CAST_CHECKS
+
+ return static_cast<Dest>(source);
+}
+
+template<typename Dest, typename Source>
+typename std::enable_if_t<
+ std::is_signed<Source>::value &&
+ std::is_signed<Dest>::value
+ , Dest>
+numeric_cast(Source source)
+{
+ static_assert(!std::is_floating_point<Source>::value && !std::is_floating_point<Dest>::value,
+ "numeric_cast doesn't cast float.");
+
+#if ENABLE_NUMERIC_CAST_CHECKS
+ if (source > std::numeric_limits<Dest>::max())
+ {
+ ARM_PIPE_NUMERIC_CAST_CHECK(false, "numeric_cast failed casting signed type to narrower signed type. "
+ "Overflow detected.");
+ }
+
+ if (source < std::numeric_limits<Dest>::lowest())
+ {
+ ARM_PIPE_NUMERIC_CAST_CHECK(false, "numeric_cast failed casting signed type to narrower signed type. "
+ "Underflow detected.");
+ }
+#endif // ENABLE_NUMERIC_CAST_CHECKS
+
+ return static_cast<Dest>(source);
+}
+
+// numeric cast from unsigned to signed checked for narrowing overflows
+template<typename Dest, typename Source>
+typename std::enable_if_t<
+ std::is_signed<Dest>::value &&
+ std::is_unsigned<Source>::value
+ , Dest>
+numeric_cast(Source sValue)
+{
+ static_assert(!std::is_floating_point<Dest>::value, "numeric_cast doesn't cast to float.");
+
+#if ENABLE_NUMERIC_CAST_CHECKS
+ if (sValue > static_cast< typename std::make_unsigned<Dest>::type >(std::numeric_limits<Dest>::max()))
+ {
+ ARM_PIPE_NUMERIC_CAST_CHECK(false, "numeric_cast failed casting unsigned type to signed type. "
+ "Overflow detected.");
+ }
+#endif // ENABLE_NUMERIC_CAST_CHECKS
+
+ return static_cast<Dest>(sValue);
+}
+
+// numeric cast from signed to unsigned checked for underflows and narrowing overflows
+template<typename Dest, typename Source>
+typename std::enable_if_t<
+ std::is_unsigned<Dest>::value &&
+ std::is_signed<Source>::value
+ , Dest>
+numeric_cast(Source sValue)
+{
+ static_assert(!std::is_floating_point<Source>::value && !std::is_floating_point<Dest>::value,
+ "numeric_cast doesn't cast floats.");
+
+#if ENABLE_NUMERIC_CAST_CHECKS
+ if (sValue < 0)
+ {
+ ARM_PIPE_NUMERIC_CAST_CHECK(false, "numeric_cast failed casting negative value to unsigned type. "
+ "Underflow detected.");
+ }
+
+ if (static_cast< typename std::make_unsigned<Source>::type >(sValue) > std::numeric_limits<Dest>::max())
+ {
+ ARM_PIPE_NUMERIC_CAST_CHECK(false, "numeric_cast failed casting signed type to unsigned type. "
+ "Overflow detected.");
+ }
+
+#endif // ENABLE_NUMERIC_CAST_CHECKS
+ return static_cast<Dest>(sValue);
+}
+
+#undef ENABLE_NUMERIC_CAST_CHECKS
+
+} // namespace pipe
+} // namespace arm
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include <armnn/Exceptions.hpp>
+#include "ProfilingException.hpp"
#include <memory>
-namespace armnn
+namespace arm
{
-namespace profiling
+namespace pipe
{
class Packet
if (length == 0 && m_Data != nullptr)
{
- throw armnn::InvalidArgumentException("Data should be null when length is zero");
+ throw arm::pipe::InvalidArgumentException("Data should be null when length is zero");
}
}
std::unique_ptr<unsigned char[]> m_Data;
};
-} // namespace profiling
+} // namespace pipe
-} // namespace armnn
+} // namespace arm
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "EncodeVersion.hpp"
-namespace armnn
+namespace arm
{
-namespace profiling
+namespace pipe
{
class PacketKey final
Version ResolvePacketVersion(uint32_t familyId, uint32_t packetId) const;
};
-} // namespace profiling
+} // namespace pipe
-} // namespace armnn
+} // namespace arm
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include <stdexcept>
#include <string>
+#include <sstream>
-namespace armnnProfiling
+namespace arm
{
+namespace pipe
+{
+
+struct Location
+{
+ const char* m_Function;
+ const char* m_File;
+ unsigned int m_Line;
+
+ Location(const char* func,
+ const char* file,
+ unsigned int line)
+ : m_Function{func}
+ , m_File{file}
+ , m_Line{line}
+ {
+ }
+
+ std::string AsString() const
+ {
+ std::stringstream ss;
+ ss << " at function " << m_Function
+ << " [" << m_File << ':' << m_Line << "]";
+ return ss.str();
+ }
+
+ std::string FileLine() const
+ {
+ std::stringstream ss;
+ ss << " [" << m_File << ':' << m_Line << "]";
+ return ss.str();
+ }
+};
+
/// General Exception class for Profiling code
class ProfilingException : public std::exception
{
public:
explicit ProfilingException(const std::string& message) : m_Message(message) {};
+ explicit ProfilingException(const std::string& message,
+ const Location& location) : m_Message(message + location.AsString()) {};
+
/// @return - Error message of ProfilingException
- virtual const char* what() const noexcept override
+ virtual const char *what() const noexcept override
{
- return m_Message.c_str();
+ return m_Message.c_str();
}
private:
std::string m_Message;
};
-} // namespace armnnProfiling
+class TimeoutException : public ProfilingException
+{
+public:
+ using ProfilingException::ProfilingException;
+};
+
+class InvalidArgumentException : public ProfilingException
+{
+public:
+ using ProfilingException::ProfilingException;
+};
+
+} // namespace pipe
+} // namespace arm
+
+#define LOCATION() arm::pipe::Location(__func__, __FILE__, __LINE__)
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include "NetworkSockets.hpp"
-namespace armnnProfiling
+namespace arm
+{
+
+namespace pipe
{
/// Socket Connection Exception for profiling
class SocketConnectionException : public std::exception
{
public:
- explicit SocketConnectionException(const std::string& message, armnnUtils::Sockets::Socket socket)
- : m_Message(message), m_Socket(socket), m_ErrNo(-1)
- {};
+ explicit SocketConnectionException(const std::string &message, arm::pipe::Socket socket)
+ : m_Message(message), m_Socket(socket), m_ErrNo(-1) {};
- explicit SocketConnectionException(const std::string& message, armnnUtils::Sockets::Socket socket, int errNo)
- : m_Message(message), m_Socket(socket), m_ErrNo(errNo)
- {};
+ explicit SocketConnectionException(const std::string &message, arm::pipe::Socket socket, int errNo)
+ : m_Message(message), m_Socket(socket), m_ErrNo(errNo) {};
/// @return - Error message of SocketProfilingConnection
- virtual const char* what() const noexcept override
+ virtual const char *what() const noexcept override
{
return m_Message.c_str();
}
/// @return - Socket File Descriptor of SocketProfilingConnection
/// or '-1', an invalid file descriptor
- armnnUtils::Sockets::Socket GetSocketFd() const noexcept
+ arm::pipe::Socket GetSocketFd() const noexcept
{
return m_Socket;
}
private:
std::string m_Message;
- armnnUtils::Sockets::Socket m_Socket;
+ arm::pipe::Socket m_Socket;
int m_ErrNo;
};
-
-} // namespace armnnProfiling
+} // namespace pipe
+} // namespace arm
--- /dev/null
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include "NumericCast.hpp"
+
+#include <algorithm>
+#include <cstring>
+#include <string>
+#include <vector>
+
+namespace arm
+{
+
+namespace pipe
+{
+
+struct SwTraceHeader
+{
+ uint8_t m_StreamVersion;
+ uint8_t m_PointerBytes;
+ uint8_t m_ThreadIdBytes;
+};
+
+struct SwTraceMessage
+{
+ uint32_t m_Id;
+ std::string m_Name;
+ std::string m_UiName;
+ std::vector<char> m_ArgTypes;
+ std::vector<std::string> m_ArgNames;
+};
+
+struct SwTraceCharPolicy
+{
+ static bool IsValidChar(unsigned char c)
+ {
+ // Check that the given character has ASCII 7-bit encoding
+ return c < 128;
+ }
+};
+
+struct SwTraceNameCharPolicy
+{
+ static bool IsValidChar(unsigned char c)
+ {
+ // Check that the given character has ASCII 7-bit encoding, alpha-numeric and underscore only
+ return c < 128 && (std::isalnum(c) || c == '_');
+ }
+};
+
+struct SwTraceTypeCharPolicy
+{
+ static bool IsValidChar(unsigned char c)
+ {
+ // Check that the given character is among the allowed ones
+ switch (c)
+ {
+ case '@':
+ case 't':
+ case 'i':
+ case 'I':
+ case 'l':
+ case 'L':
+ case 'F':
+ case 'p':
+ case 's':
+ return true; // Valid char
+ default:
+ return false; // Invalid char
+ }
+ }
+};
+
+template <typename SwTracePolicy>
+bool IsValidSwTraceString(const std::string& s)
+{
+ // Check that all the characters in the given string conform to the given policy
+ return std::all_of(s.begin(), s.end(), [](unsigned char c) { return SwTracePolicy::IsValidChar(c); });
+}
+
+template <typename SwTracePolicy>
+bool StringToSwTraceString(const std::string& s, std::vector<uint32_t>& outputBuffer)
+{
+ // Converts the given string to an SWTrace "string" (i.e. a string of "chars"), and writes it into
+ // the given buffer including the null-terminator. It also pads it to the next uint32_t if necessary
+
+ // Clear the output buffer
+ outputBuffer.clear();
+
+ // Check that the given string is a valid SWTrace "string" (i.e. a string of "chars")
+ if (!IsValidSwTraceString<SwTracePolicy>(s))
+ {
+ return false;
+ }
+
+ // Prepare the output buffer
+ size_t s_size = s.size() + 1; // The size of the string (in chars) plus the null-terminator
+ size_t uint32_t_size = sizeof(uint32_t);
+ // Output buffer size = StringLength (32 bit) + amount of complete 32bit words that fit into the string
+ // + an additional 32bit word if there are remaining chars to complete the string
+ // (The rest of the 32bit word is then filled with the NULL terminator)
+ size_t outBufferSize = 1 + (s_size / uint32_t_size) + (s_size % uint32_t_size != 0 ? 1 : 0);
+ outputBuffer.resize(outBufferSize, '\0');
+
+ // Write the SWTrace string to the output buffer
+ outputBuffer[0] = numeric_cast<uint32_t>(s_size);
+ std::memcpy(outputBuffer.data() + 1, s.data(), s_size);
+
+ return true;
+}
+
+template <typename SwTracePolicy,
+ typename SwTraceBuffer = std::vector<uint32_t>>
+bool ConvertDirectoryComponent(const std::string& directoryComponent, SwTraceBuffer& swTraceBuffer)
+{
+ // Convert the directory component using the given policy
+ SwTraceBuffer tempSwTraceBuffer;
+ bool result = StringToSwTraceString<SwTracePolicy>(directoryComponent, tempSwTraceBuffer);
+ if (!result)
+ {
+ return false;
+ }
+
+ swTraceBuffer.insert(swTraceBuffer.end(), tempSwTraceBuffer.begin(), tempSwTraceBuffer.end());
+
+ return true;
+}
+
+uint32_t CalculateSizeOfPaddedSwString(const std::string& str);
+
+SwTraceMessage ReadSwTraceMessage(const unsigned char*, unsigned int&, const unsigned int& packetLength);
+
+} // namespace pipe
+
+} // namespace arm
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#undef CreateEvent // ITimelineDecoder.hpp
#endif
+
+#if defined(__MINGW32__)
+
+#define NOMINMAX // Prevent definition of min/max macros that interfere with std::min/max
+#define WIN32_LEAN_AND_MEAN
+#define WINVER 0x0A00
+#define _WIN32_WINNT 0x0A00
+#include <windows.h>
+// Windows.h defines some names that we don't need and interfere with some of our definition
+#undef TIME_MS // Instrument.hpp
+#undef CreateEvent // ITimelineDecoder.hpp
+
+#endif
--- /dev/null
+#
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+# SPDX-License-Identifier: MIT
+#
+
+if(BUILD_TIMELINE_DECODER)
+ set(pipeCommon_sources)
+ list(APPEND pipeCommon_sources
+ CommandHandlerFunctor.cpp
+ CommandHandlerKey.cpp
+ CommandHandlerRegistry.cpp
+ CommonProfilingUtils.cpp
+ NetworkSockets.cpp
+ PacketVersionResolver.cpp
+ SwTrace.cpp)
+
+ include_directories(${PROJECT_SOURCE_DIR}/profiling/common/include)
+ include_directories(${PROJECT_SOURCE_DIR}/common/include)
+
+ if(BUILD_UNIT_TESTS)
+ include_directories(${PROJECT_SOURCE_DIR}/src/profiling
+ ${PROJECT_SOURCE_DIR}/src/armnnUtils)
+ target_include_directories(UnitTests PRIVATE ${PROJECT_SOURCE_DIR}/profiling/common/include)
+ endif()
+
+ # will only build a static version of this common code
+ # to simplify the build. No extra .so file to deploy to boards etc.
+ add_library_ex(pipeCommon STATIC ${pipeCommon_sources})
+
+endif()
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "CommandHandlerFunctor.hpp"
-namespace armnn
+namespace arm
{
-namespace profiling
+namespace pipe
{
uint32_t CommandHandlerFunctor::GetFamilyId() const
return m_Version;
}
-} // namespace profiling
+} // namespace pipe
-} // namespace armnn
+} // namespace arm
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "CommandHandlerKey.hpp"
-namespace armnn
+namespace arm
{
-namespace profiling
+namespace pipe
{
uint32_t CommandHandlerKey::GetFamilyId() const
return !(*this == rhs);
}
-} // namespace profiling
+} // namespace pipe
-} // namespace armnn
+} // namespace arm
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
-#include "CommandHandlerRegistry.hpp"
-#include <armnn/utility/Assert.hpp>
+#include <common/include/Assert.hpp>
+#include <common/include/CommandHandlerRegistry.hpp>
-#include <boost/format.hpp>
+#include <sstream>
-namespace armnn
+namespace arm
{
-namespace profiling
+namespace pipe
{
void CommandHandlerRegistry::RegisterFunctor(CommandHandlerFunctor* functor,
uint32_t packetId,
uint32_t version)
{
- ARMNN_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
+ ARM_PIPE_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
CommandHandlerKey key(familyId, packetId, version);
registry[key] = functor;
void CommandHandlerRegistry::RegisterFunctor(CommandHandlerFunctor* functor)
{
- ARMNN_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
+ ARM_PIPE_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
RegisterFunctor(functor, functor->GetFamilyId(), functor->GetPacketId(), functor->GetVersion());
}
// Check that the requested key exists
if (registry.find(key) == registry.end())
{
- throw armnn::InvalidArgumentException(
- boost::str(boost::format("Functor with requested PacketId=%1% and Version=%2% does not exist")
- % packetId
- % version));
+ std::stringstream ss;
+ ss << "Functor with requested PacketId=" << packetId << " and Version=" << version << " does not exist";
+ throw ProfilingException(ss.str());
}
CommandHandlerFunctor* commandHandlerFunctor = registry.at(key);
if (commandHandlerFunctor == nullptr)
{
- throw RuntimeException(
- boost::str(boost::format("Invalid functor registered for PacketId=%1% and Version=%2%")
- % packetId
- % version));
+ std::stringstream ss;
+ ss << "Invalid functor registered for PacketId=" << packetId << " and Version=" << version;
+ throw ProfilingException(ss.str());
}
return commandHandlerFunctor;
}
-} // namespace profiling
+} // namespace pipe
-} // namespace armnn
+} // namespace arm
--- /dev/null
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include <common/include/Assert.hpp>
+#include <common/include/CommonProfilingUtils.hpp>
+
+#include <sstream>
+
+namespace arm
+{
+
+namespace pipe
+{
+void ReadBytes(const unsigned char* buffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
+{
+ ARM_PIPE_ASSERT(buffer);
+ ARM_PIPE_ASSERT(outValue);
+
+ for (unsigned int i = 0; i < valueSize; i++, offset++)
+ {
+ outValue[i] = static_cast<uint8_t>(buffer[offset]);
+ }
+}
+
+uint64_t ReadUint64(const unsigned char* buffer, unsigned int offset)
+{
+ ARM_PIPE_ASSERT(buffer);
+
+ uint64_t value = 0;
+ value = static_cast<uint64_t>(buffer[offset]);
+ value |= static_cast<uint64_t>(buffer[offset + 1]) << 8;
+ value |= static_cast<uint64_t>(buffer[offset + 2]) << 16;
+ value |= static_cast<uint64_t>(buffer[offset + 3]) << 24;
+ value |= static_cast<uint64_t>(buffer[offset + 4]) << 32;
+ value |= static_cast<uint64_t>(buffer[offset + 5]) << 40;
+ value |= static_cast<uint64_t>(buffer[offset + 6]) << 48;
+ value |= static_cast<uint64_t>(buffer[offset + 7]) << 56;
+
+ return value;
+}
+
+uint32_t ReadUint32(const unsigned char* buffer, unsigned int offset)
+{
+ ARM_PIPE_ASSERT(buffer);
+
+ uint32_t value = 0;
+ value = static_cast<uint32_t>(buffer[offset]);
+ value |= static_cast<uint32_t>(buffer[offset + 1]) << 8;
+ value |= static_cast<uint32_t>(buffer[offset + 2]) << 16;
+ value |= static_cast<uint32_t>(buffer[offset + 3]) << 24;
+ return value;
+}
+
+uint16_t ReadUint16(const unsigned char* buffer, unsigned int offset)
+{
+ ARM_PIPE_ASSERT(buffer);
+
+ uint32_t value = 0;
+ value = static_cast<uint32_t>(buffer[offset]);
+ value |= static_cast<uint32_t>(buffer[offset + 1]) << 8;
+ return static_cast<uint16_t>(value);
+}
+
+uint8_t ReadUint8(const unsigned char* buffer, unsigned int offset)
+{
+ ARM_PIPE_ASSERT(buffer);
+
+ return buffer[offset];
+}
+
+void WriteBytes(unsigned char* buffer, unsigned int offset, const void* value, unsigned int valueSize)
+{
+ ARM_PIPE_ASSERT(buffer);
+ ARM_PIPE_ASSERT(value);
+
+ for (unsigned int i = 0; i < valueSize; i++, offset++)
+ {
+ buffer[offset] = *(reinterpret_cast<const unsigned char*>(value) + i);
+ }
+}
+
+void WriteUint64(unsigned char* buffer, unsigned int offset, uint64_t value)
+{
+ ARM_PIPE_ASSERT(buffer);
+
+ buffer[offset] = static_cast<unsigned char>(value & 0xFF);
+ buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
+ buffer[offset + 2] = static_cast<unsigned char>((value >> 16) & 0xFF);
+ buffer[offset + 3] = static_cast<unsigned char>((value >> 24) & 0xFF);
+ buffer[offset + 4] = static_cast<unsigned char>((value >> 32) & 0xFF);
+ buffer[offset + 5] = static_cast<unsigned char>((value >> 40) & 0xFF);
+ buffer[offset + 6] = static_cast<unsigned char>((value >> 48) & 0xFF);
+ buffer[offset + 7] = static_cast<unsigned char>((value >> 56) & 0xFF);
+}
+
+void WriteUint32(unsigned char* buffer, unsigned int offset, uint32_t value)
+{
+ ARM_PIPE_ASSERT(buffer);
+
+ buffer[offset] = static_cast<unsigned char>(value & 0xFF);
+ buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
+ buffer[offset + 2] = static_cast<unsigned char>((value >> 16) & 0xFF);
+ buffer[offset + 3] = static_cast<unsigned char>((value >> 24) & 0xFF);
+}
+
+void WriteUint16(unsigned char* buffer, unsigned int offset, uint16_t value)
+{
+ ARM_PIPE_ASSERT(buffer);
+
+ buffer[offset] = static_cast<unsigned char>(value & 0xFF);
+ buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
+}
+
+void WriteUint8(unsigned char* buffer, unsigned int offset, uint8_t value)
+{
+ ARM_PIPE_ASSERT(buffer);
+
+ buffer[offset] = static_cast<unsigned char>(value);
+}
+
+std::string CentreAlignFormatting(const std::string& stringToPass, const int spacingWidth)
+{
+ std::stringstream outputStream, centrePadding;
+ int padding = spacingWidth - static_cast<int>(stringToPass.size());
+
+ for (int i = 0; i < padding / 2; ++i)
+ {
+ centrePadding << " ";
+ }
+
+ outputStream << centrePadding.str() << stringToPass << centrePadding.str();
+
+ if (padding > 0 && padding %2 != 0)
+ {
+ outputStream << " ";
+ }
+
+ return outputStream.str();
+}
+
+
+} // namespace pipe
+} // namespace arm
\ No newline at end of file
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
-#include "common/include/NetworkSockets.hpp"
+#include <common/include/NetworkSockets.hpp>
#if defined(__unix__) || defined(__APPLE__)
#include <unistd.h>
#include <fcntl.h>
-#include <armnn/Conversion.hpp>
+#include <common/include/Conversion.hpp>
+#endif
+
+#if defined(__APPLE__) || defined(_MSC_VER) || defined(__MINGW32__)
+#include <common/include/IgnoreUnused.hpp>
+#endif
+#if defined(__MINGW32__)
+#include <common/include/Conversion.hpp>
+#include <common/include/NumericCast.hpp>
#endif
-namespace armnnUtils
+namespace arm
{
-namespace Sockets
+namespace pipe
{
bool Initialize()
{
#if defined(__unix__) || defined(__APPLE__)
return true;
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) || defined(__MINGW32__)
WSADATA wsaData;
return WSAStartup(MAKEWORD(2, 2), &wsaData) == 0;
#endif
{
#if defined(__unix__) || defined(__APPLE__)
return close(s);
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) || defined(__MINGW32__)
return closesocket(s);
#endif
}
#elif defined(_MSC_VER)
u_long mode = 1;
return ioctlsocket(s, FIONBIO, &mode) == 0;
+#elif defined(__MINGW32__)
+ u_long mode = 1;
+ return ioctlsocket(s, arm::pipe::numeric_cast<long>(FIONBIO), &mode) == 0;
#endif
}
{
#if defined(__unix__) || defined(__APPLE__)
return write(s, buf, len);
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) || defined(__MINGW32__)
return send(s, static_cast<const char*>(buf), static_cast<int>(len), 0);
#endif
}
{
#if defined(__unix__) || defined(__APPLE__)
return read(s, buf, len);
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) || defined(__MINGW32__)
return recv(s, static_cast<char*>(buf), static_cast<int>(len), 0);
#endif
}
int Ioctl(Socket s, unsigned long int cmd, void* arg)
{
#if defined(__unix__) || defined(__APPLE__)
- ARMNN_NO_CONVERSION_WARN_BEGIN
+ ARM_PIPE_NO_CONVERSION_WARN_BEGIN
return ioctl(s, static_cast<int>(cmd), arg);
- ARMNN_NO_CONVERSION_WARN_END
-#elif defined(_MSC_VER)
+ ARM_PIPE_NO_CONVERSION_WARN_END
+#elif defined(_MSC_VER) || defined(__MINGW32__)
+ ARM_PIPE_NO_CONVERSION_WARN_BEGIN
return ioctlsocket(s, cmd, static_cast<u_long*>(arg));
+ ARM_PIPE_NO_CONVERSION_WARN_END
#endif
}
{
#if defined(__unix__) || defined(__APPLE__)
return poll(fds, numFds, timeout);
-#elif defined(_MSC_VER)
- return WSAPoll(fds, numFds, timeout);
+#elif defined(_MSC_VER) || defined(__MINGW32__)
+ return WSAPoll(fds, arm::pipe::numeric_cast<unsigned long>(numFds), timeout);
#endif
}
-armnnUtils::Sockets::Socket Accept(Socket s, sockaddr* addr, socklen_t* addrlen, int flags)
+arm::pipe::Socket Accept(Socket s, sockaddr* addr, socklen_t* addrlen, int flags)
{
#if defined(__unix__)
return accept4(s, addr, addrlen, flags);
#elif defined(__APPLE__)
+ IgnoreUnused(flags);
return accept(s, addr, addrlen);
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) || defined(__MINGW32__)
+ IgnoreUnused(flags);
return accept(s, addr, reinterpret_cast<int*>(addrlen));
#endif
}
-}
-}
+} // pipe
+} // arm
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
-#include "PacketVersionResolver.hpp"
+#include <common/include/PacketVersionResolver.hpp>
-#include <armnn/utility/IgnoreUnused.hpp>
-
-namespace armnn
+namespace arm
{
-namespace profiling
+namespace pipe
{
bool PacketKey::operator<(const PacketKey& rhs) const
return Version(1, 0, 0);
}
-} // namespace profiling
+} // namespace pipe
-} // namespace armnn
+} // namespace arm
--- /dev/null
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include <common/include/CommonProfilingUtils.hpp>
+#include <common/include/NumericCast.hpp>
+#include <common/include/ProfilingException.hpp>
+#include <common/include/SwTrace.hpp>
+
+#include <sstream>
+
+namespace arm
+{
+
+namespace pipe
+{
+
+// Calculate the actual length an SwString will be including the terminating null character
+// padding to bring it to the next uint32_t boundary but minus the leading uint32_t encoding
+// the size to allow the offset to be correctly updated when decoding a binary packet.
+uint32_t CalculateSizeOfPaddedSwString(const std::string& str)
+{
+ std::vector<uint32_t> swTraceString;
+ StringToSwTraceString<SwTraceCharPolicy>(str, swTraceString);
+ unsigned int uint32_t_size = sizeof(uint32_t);
+ uint32_t size = (numeric_cast<uint32_t>(swTraceString.size()) - 1) * uint32_t_size;
+ return size;
+}
+
+// Read TimelineMessageDirectoryPacket from given IPacketBuffer and offset
+SwTraceMessage ReadSwTraceMessage(const unsigned char* packetBuffer,
+ unsigned int& offset,
+ const unsigned int& packetLength)
+{
+ ARM_PIPE_ASSERT(packetBuffer);
+
+ unsigned int uint32_t_size = sizeof(uint32_t);
+
+ SwTraceMessage swTraceMessage;
+
+ // Read the decl_id
+ uint32_t readDeclId = ReadUint32(packetBuffer, offset);
+ swTraceMessage.m_Id = readDeclId;
+
+ // SWTrace "namestring" format
+ // length of the string (first 4 bytes) + string + null terminator
+
+ // Check the decl_name
+ offset += uint32_t_size;
+ uint32_t swTraceDeclNameLength = ReadUint32(packetBuffer, offset);
+
+ if (swTraceDeclNameLength == 0 || swTraceDeclNameLength > packetLength)
+ {
+ throw arm::pipe::ProfilingException("Error swTraceDeclNameLength is an invalid size", LOCATION());
+ }
+
+ offset += uint32_t_size;
+ std::vector<unsigned char> swTraceStringBuffer(swTraceDeclNameLength - 1);
+ std::memcpy(swTraceStringBuffer.data(),
+ packetBuffer + offset, swTraceStringBuffer.size());
+
+ swTraceMessage.m_Name.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end()); // name
+
+ // Check the ui_name
+ offset += CalculateSizeOfPaddedSwString(swTraceMessage.m_Name);
+ uint32_t swTraceUINameLength = ReadUint32(packetBuffer, offset);
+
+ if (swTraceUINameLength == 0 || swTraceUINameLength > packetLength)
+ {
+ throw arm::pipe::ProfilingException("Error swTraceUINameLength is an invalid size", LOCATION());
+ }
+
+ offset += uint32_t_size;
+ swTraceStringBuffer.resize(swTraceUINameLength - 1);
+ std::memcpy(swTraceStringBuffer.data(),
+ packetBuffer + offset, swTraceStringBuffer.size());
+
+ swTraceMessage.m_UiName.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end()); // ui_name
+
+ // Check arg_types
+ offset += CalculateSizeOfPaddedSwString(swTraceMessage.m_UiName);
+ uint32_t swTraceArgTypesLength = ReadUint32(packetBuffer, offset);
+
+ if (swTraceArgTypesLength == 0 || swTraceArgTypesLength > packetLength)
+ {
+ throw arm::pipe::ProfilingException("Error swTraceArgTypesLength is an invalid size", LOCATION());
+ }
+
+ offset += uint32_t_size;
+ swTraceStringBuffer.resize(swTraceArgTypesLength - 1);
+ std::memcpy(swTraceStringBuffer.data(),
+ packetBuffer + offset, swTraceStringBuffer.size());
+
+ swTraceMessage.m_ArgTypes.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end()); // arg_types
+
+ std::string swTraceString(swTraceStringBuffer.begin(), swTraceStringBuffer.end());
+
+ // Check arg_names
+ offset += CalculateSizeOfPaddedSwString(swTraceString);
+ uint32_t swTraceArgNamesLength = ReadUint32(packetBuffer, offset);
+
+ if (swTraceArgNamesLength == 0 || swTraceArgNamesLength > packetLength)
+ {
+ throw arm::pipe::ProfilingException("Error swTraceArgNamesLength is an invalid size", LOCATION());
+ }
+
+ offset += uint32_t_size;
+ swTraceStringBuffer.resize(swTraceArgNamesLength - 1);
+ std::memcpy(swTraceStringBuffer.data(),
+ packetBuffer + offset, swTraceStringBuffer.size());
+
+ swTraceString.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end());
+ std::stringstream stringStream(swTraceString);
+ std::string argName;
+ while (std::getline(stringStream, argName, ','))
+ {
+ swTraceMessage.m_ArgNames.push_back(argName);
+ }
+
+ offset += CalculateSizeOfPaddedSwString(swTraceString);
+
+ return swTraceMessage;
+}
+
+} // namespace pipe
+
+} // namespace arm
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include <NetworkSockets.hpp>
-#include <Packet.hpp>
-#include <SocketConnectionException.hpp>
+#include <common/include/NetworkSockets.hpp>
+#include <common/include/Packet.hpp>
+#include <common/include/SocketConnectionException.hpp>
#include <string>
#include <atomic>
-namespace armnnProfiling
+namespace arm
+{
+
+namespace pipe
{
enum class TargetEndianness
public:
- BasePipeServer(armnnUtils::Sockets::Socket clientConnection, bool echoPackets)
+ BasePipeServer(arm::pipe::Socket clientConnection, bool echoPackets)
: m_ClientConnection(clientConnection)
, m_EchoPackets(echoPackets)
{}
~BasePipeServer()
{
// We have set SOCK_CLOEXEC on this socket but we'll close it to be good citizens.
- armnnUtils::Sockets::Close(m_ClientConnection);
+ arm::pipe::Close(m_ClientConnection);
}
BasePipeServer(const BasePipeServer&) = delete;
/// @return 0 if successful
int Close()
{
- return armnnUtils::Sockets::Close(m_ClientConnection);
+ return arm::pipe::Close(m_ClientConnection);
}
/// Send a packet to the client
/// @return true if successful.
bool SetNonBlocking()
{
- return armnnUtils::Sockets::SetNonBlocking(m_ClientConnection);
+ return arm::pipe::SetNonBlocking(m_ClientConnection);
}
/// Block on the client connection until a complete packet has been received.
/// @return true if a valid packet has been received.
- armnn::profiling::Packet WaitForPacket(uint32_t timeoutMs);
+ arm::pipe::Packet WaitForPacket(uint32_t timeoutMs);
/// Once the connection is open wait to receive the stream meta data packet from the client. Reading this
/// packet differs from others as we need to determine endianness.
bool ReadFromSocket(uint8_t* packetData, uint32_t expectedLength);
bool ReadHeader(uint32_t headerAsWords[2]);
- armnn::profiling::Packet ReceivePacket();
+ arm::pipe::Packet ReceivePacket();
uint32_t ToUint32(uint8_t* data, TargetEndianness endianness);
void InsertU32(uint32_t value, uint8_t* data, TargetEndianness endianness);
- armnnUtils::Sockets::Socket m_ClientConnection;
+ arm::pipe::Socket m_ClientConnection;
bool m_EchoPackets;
TargetEndianness m_Endianness;
uint32_t m_StreamMetaDataPid;
};
-} // namespace armnnProfiling
\ No newline at end of file
+} // namespace pipe
+} // namespace arm
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "BasePipeServer.hpp"
#include <string>
-namespace armnnProfiling
+namespace arm
+{
+
+namespace pipe
{
class ConnectionHandler
~ConnectionHandler()
{
// We have set SOCK_CLOEXEC on this socket but we'll close it to be good citizens.
- armnnUtils::Sockets::Close(m_ListeningSocket);
+ arm::pipe::Close(m_ListeningSocket);
}
ConnectionHandler(const ConnectionHandler&) = delete;
private:
- armnnUtils::Sockets::Socket m_ListeningSocket;
+ arm::pipe::Socket m_ListeningSocket;
};
-} // namespace armnnProfiling
\ No newline at end of file
+} // namespace pipe
+} // namespace arm
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include <cstdint>
#include <string>
+namespace arm
+{
+
+namespace pipe
+{
+
class ITimelineDecoder
{
virtual TimelineStatus CreateEvent(const Event&) = 0;
virtual TimelineStatus CreateLabel(const Label&) = 0;
virtual TimelineStatus CreateRelationship(const Relationship&) = 0;
-};
\ No newline at end of file
+};
+
+} // namespace pipe
+} // namespace arm
#pragma once
-#include <armnn/profiling/ITimelineDecoder.hpp>
+#include "ITimelineDecoder.hpp"
-#include <CommandHandlerFunctor.hpp>
-#include <Packet.hpp>
-#include <ProfilingUtils.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
-namespace armnn
+namespace arm
{
-namespace timelinedecoder
+namespace pipe
{
-class TimelineCaptureCommandHandler :
- public profiling::CommandHandlerFunctor
+class TimelineCaptureCommandHandler : public arm::pipe::CommandHandlerFunctor
{
// Utils
uint32_t uint32_t_size = sizeof(uint32_t);
, m_PacketLength(0)
{}
- void operator()(const armnn::profiling::Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
void SetThreadIdSize(uint32_t size);
private:
- void ParseData(const armnn::profiling::Packet& packet);
+ void ParseData(const arm::pipe::Packet& packet);
ITimelineDecoder::TimelineStatus ReadLabel(const unsigned char* data, uint32_t& offset);
ITimelineDecoder::TimelineStatus ReadEntity(const unsigned char* data, uint32_t& offset);
};
-} //namespace gatordmock
+} //namespace pipe
-} //namespace armnn
+} //namespace arm
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include <armnn/profiling/ITimelineDecoder.hpp>
+#include "ITimelineDecoder.hpp"
#include <vector>
-namespace armnn
+namespace arm
{
-namespace timelinedecoder
+
+namespace pipe
{
+
class TimelineDecoder : public ITimelineDecoder
{
void printEvents();
};
-}
-}
\ No newline at end of file
+} // namespace pipe
+} // namespace arm
\ No newline at end of file
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "TimelineCaptureCommandHandler.hpp"
-#include <Packet.hpp>
-#include <PacketBuffer.hpp>
-#include <ProfilingUtils.hpp>
+#include <common/include/SwTrace.hpp>
-namespace armnn
+namespace arm
{
-namespace timelinedecoder
+namespace pipe
{
-class TimelineDirectoryCaptureCommandHandler : public profiling::CommandHandlerFunctor
+class TimelineDirectoryCaptureCommandHandler : public arm::pipe::CommandHandlerFunctor
{
// Utils
uint32_t uint8_t_size = sizeof(uint8_t);
, m_QuietOperation(quietOperation)
{}
- void operator()(const armnn::profiling::Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
- profiling::SwTraceHeader m_SwTraceHeader;
- std::vector<profiling::SwTraceMessage> m_SwTraceMessages;
+ arm::pipe::SwTraceHeader m_SwTraceHeader;
+ std::vector<arm::pipe::SwTraceMessage> m_SwTraceMessages;
private:
- void ParseData(const armnn::profiling::Packet& packet);
+ void ParseData(const arm::pipe::Packet& packet);
void Print();
TimelineCaptureCommandHandler& m_TimelineCaptureCommandHandler;
bool m_QuietOperation;
};
-} //namespace gatordmock
+} //namespace pipe
-} //namespace armnn
+} //namespace arm
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
-#include "BasePipeServer.hpp"
+#include <server/include/basePipeServer/BasePipeServer.hpp>
-#include "common/include/Constants.hpp"
+#include <common/include/Constants.hpp>
+#include <common/include/NumericCast.hpp>
#include <iostream>
-#include <boost/cast.hpp>
#include <vector>
#include <iomanip>
#include <string.h>
-using namespace armnnUtils;
+namespace arm
+{
-namespace armnnProfiling
+namespace pipe
{
bool BasePipeServer::ReadFromSocket(uint8_t* packetData, uint32_t expectedLength)
{
// This is a blocking read until either expectedLength has been received or an error is detected.
long totalBytesRead = 0;
- while (boost::numeric_cast<uint32_t>(totalBytesRead) < expectedLength)
+ while (arm::pipe::numeric_cast<uint32_t>(totalBytesRead) < expectedLength)
{
- long bytesRead = Sockets::Read(m_ClientConnection, packetData, expectedLength);
+ long bytesRead = arm::pipe::Read(m_ClientConnection, packetData, expectedLength);
if (bytesRead < 0)
{
std::cerr << ": Failure when reading from client socket: " << strerror(errno) << std::endl;
EchoPacket(PacketDirection::ReceivedData, pipeMagic, 4);
// Before we interpret the length we need to read the pipe_magic word to determine endianness.
- if (ToUint32(&pipeMagic[0], TargetEndianness::BeWire) == armnnProfiling::PIPE_MAGIC)
+ if (ToUint32(&pipeMagic[0], TargetEndianness::BeWire) == PIPE_MAGIC)
{
m_Endianness = TargetEndianness::BeWire;
}
- else if (ToUint32(&pipeMagic[0], TargetEndianness::LeWire) == armnnProfiling::PIPE_MAGIC)
+ else if (ToUint32(&pipeMagic[0], TargetEndianness::LeWire) == PIPE_MAGIC)
{
m_Endianness = TargetEndianness::LeWire;
}
else
{
- std::cerr << ": Protocol read error. Unable to read PIPE_MAGIC value." << std::endl;
+ std::cerr << ": Protocol read error. Unable to read the PIPE_MAGIC value." << std::endl;
return false;
}
// Now we know the endianness we can get the length from the header.
// Read the entire packet.
std::vector<uint8_t> packetData(metaDataLength);
if (metaDataLength !=
- boost::numeric_cast<uint32_t>(Sockets::Read(m_ClientConnection, packetData.data(), metaDataLength)))
+ arm::pipe::numeric_cast<uint32_t>(arm::pipe::Read(m_ClientConnection, packetData.data(), metaDataLength)))
{
std::cerr << ": Protocol read error. Data length mismatch." << std::endl;
return false;
return true;
}
-armnn::profiling::Packet BasePipeServer::WaitForPacket(uint32_t timeoutMs)
+arm::pipe::Packet BasePipeServer::WaitForPacket(uint32_t timeoutMs)
{
// Is there currently more than a headers worth of data waiting to be read?
int bytes_available;
- Sockets::Ioctl(m_ClientConnection, FIONREAD, &bytes_available);
+ arm::pipe::Ioctl(m_ClientConnection, FIONREAD, &bytes_available);
if (bytes_available > 8)
{
// Yes there is. Read it:
// No there's not. Poll for more data.
struct pollfd pollingFd[1]{};
pollingFd[0].fd = m_ClientConnection;
- int pollResult = Sockets::Poll(pollingFd, 1, static_cast<int>(timeoutMs));
+ int pollResult = arm::pipe::Poll(pollingFd, 1, static_cast<int>(timeoutMs));
switch (pollResult)
{
// Error
case -1:
- throw armnn::RuntimeException(std::string("File descriptor reported an error during polling: ") +
- strerror(errno));
+ throw ProfilingException(std::string("File descriptor reported an error during polling: ") +
+ strerror(errno));
// Timeout
case 0:
- throw armnn::TimeoutException("Timeout while waiting to receive packet.");
+ throw arm::pipe::TimeoutException("Timeout while waiting to receive packet.");
// Normal poll return. It could still contain an error signal
default:
{
if (pollingFd[0].revents == POLLNVAL)
{
- throw armnn::RuntimeException(std::string("Error while polling receiving socket: POLLNVAL"));
+ throw arm::pipe::ProfilingException(
+ std::string("Error while polling receiving socket: POLLNVAL"));
}
if (pollingFd[0].revents == POLLERR)
{
- throw armnn::RuntimeException(std::string("Error while polling receiving socket: POLLERR: ") +
- strerror(errno));
+ throw arm::pipe::ProfilingException(
+ std::string("Error while polling receiving socket: POLLERR: ") + strerror(errno));
}
if (pollingFd[0].revents == POLLHUP)
{
- throw armnn::RuntimeException(std::string("Connection closed by remote client: POLLHUP"));
+ throw arm::pipe::ProfilingException(
+ std::string("Connection closed by remote client: POLLHUP"));
}
}
{
// This is a corner case. The socket as been woken up but not with any data.
// We'll throw a timeout exception to loop around again.
- throw armnn::TimeoutException("File descriptor was polled but no data was available to receive.");
+ throw arm::pipe::TimeoutException(
+ "File descriptor was polled but no data was available to receive.");
}
return ReceivePacket();
}
}
}
-armnn::profiling::Packet BasePipeServer::ReceivePacket()
+arm::pipe::Packet BasePipeServer::ReceivePacket()
{
uint32_t header[2];
if (!ReadHeader(header))
{
- return armnn::profiling::Packet();
+ return arm::pipe::Packet();
}
// Read data_length bytes from the socket.
std::unique_ptr<unsigned char[]> uniquePacketData = std::make_unique<unsigned char[]>(header[1]);
if (!ReadFromSocket(packetData, header[1]))
{
- return armnn::profiling::Packet();
+ return arm::pipe::Packet();
}
EchoPacket(PacketDirection::ReceivedData, packetData, header[1]);
// Construct received packet
- armnn::profiling::Packet packetRx = armnn::profiling::Packet(header[0], header[1], uniquePacketData);
+ arm::pipe::Packet packetRx = arm::pipe::Packet(header[0], header[1], uniquePacketData);
if (m_EchoPackets)
{
std::cout << "Processing packet ID= " << packetRx.GetPacketId() << " Length=" << packetRx.GetLength()
memcpy((packet.data() + 8), data, dataLength);
}
EchoPacket(PacketDirection::Sending, packet.data(), packet.size());
- if (-1 == armnnUtils::Sockets::Write(m_ClientConnection, packet.data(), packet.size()))
+ if (-1 == arm::pipe::Write(m_ClientConnection, packet.data(), packet.size()))
{
std::cerr << ": Failure when writing to client socket: " << strerror(errno) << std::endl;
return false;
}
}
-} // namespace armnnProfiling
\ No newline at end of file
+} // namespace pipe
+} // namespace arm
#
-# Copyright © 2020 Arm Ltd. All rights reserved.
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
# SPDX-License-Identifier: MIT
#
if(BUILD_BASE_PIPE_SERVER)
set(BasePipeServer_sources)
list(APPEND BasePipeServer_sources
- BasePipeServer.cpp
- BasePipeServer.hpp
- ConnectionHandler.cpp
- ConnectionHandler.hpp)
+ BasePipeServer.cpp)
+
+ if(NOT "${TOOLCHAIN_PREFIX}" STREQUAL x86_64-w64-mingw32)
+ list(APPEND BasePipeServer_sources
+ ConnectionHandler.cpp)
+ endif()
include_directories(${PROJECT_SOURCE_DIR}/profiling/common/include)
+ include_directories(${PROJECT_SOURCE_DIR}/profiling/server/include/basePipeServer)
if (BUILD_UNIT_TESTS)
target_include_directories(UnitTests PRIVATE ${PROJECT_SOURCE_DIR}/profiling/server/src/basePipeServer)
target_include_directories(UnitTests PUBLIC ${PROJECT_SOURCE_DIR}/profiling/common/include)
endif()
- add_library_ex(armnnBasePipeServer SHARED ${BasePipeServer_sources})
+ if (BUILD_STATIC_PIPE_LIBS)
+ add_library_ex(armnnBasePipeServer STATIC ${BasePipeServer_sources})
+ target_link_libraries(armnnBasePipeServer pipeCommon)
- set_target_properties(armnnBasePipeServer PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
- set_target_properties(armnnBasePipeServer PROPERTIES VERSION ${GENERIC_LIB_VERSION}
- SOVERSION ${GENERIC_LIB_SOVERSION})
+ if ("${CMAKE_SYSTEM_NAME}" STREQUAL Windows)
+ target_link_libraries(armnnBasePipeServer ws2_32.lib)
+ endif()
+ else()
+ add_library_ex(armnnBasePipeServer SHARED ${BasePipeServer_sources})
+ target_link_libraries(armnnBasePipeServer pipeCommon)
- target_include_directories(armnnBasePipeServer PRIVATE ${PROJECT_SOURCE_DIR}/src/armnnUtils)
+ if ("${CMAKE_SYSTEM_NAME}" STREQUAL Windows)
+ target_link_libraries(armnnBasePipeServer ws2_32.lib)
+ endif()
- target_link_libraries(armnnBasePipeServer armnn)
- if ("${CMAKE_SYSTEM_NAME}" STREQUAL Windows)
- target_link_libraries(armnnBasePipeServer Ws2_32.lib)
- endif()
+ set_target_properties(armnnBasePipeServer PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
+ set_target_properties(armnnBasePipeServer PROPERTIES VERSION ${GENERIC_LIB_VERSION}
+ SOVERSION ${GENERIC_LIB_SOVERSION})
+
+ target_include_directories(armnnBasePipeServer PRIVATE ${PROJECT_SOURCE_DIR}/src/armnnUtils)
- install(TARGETS armnnBasePipeServer
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-endif()
\ No newline at end of file
+ install(TARGETS armnnBasePipeServer
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
+endif()
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
-#include "ConnectionHandler.hpp"
-#include <string.h>
+#include <server/include/basePipeServer/ConnectionHandler.hpp>
-using namespace armnnUtils;
+#include <string>
-namespace armnnProfiling
+namespace arm
{
+
+namespace pipe
+{
+
ConnectionHandler::ConnectionHandler(const std::string& udsNamespace, const bool setNonBlocking)
{
- Sockets::Initialize();
+ arm::pipe::Initialize();
m_ListeningSocket = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (-1 == m_ListeningSocket)
if (setNonBlocking)
{
- Sockets::SetNonBlocking(m_ListeningSocket);
+ arm::pipe::SetNonBlocking(m_ListeningSocket);
}
}
std::unique_ptr<BasePipeServer> ConnectionHandler::GetNewBasePipeServer(const bool echoPackets)
{
- armnnUtils::Sockets::Socket clientConnection = armnnUtils::Sockets::Accept(m_ListeningSocket, nullptr, nullptr,
- SOCK_CLOEXEC);
+ arm::pipe::Socket clientConnection = arm::pipe::Accept(m_ListeningSocket, nullptr, nullptr, SOCK_CLOEXEC);
if (clientConnection < 1)
{
return nullptr;
return std::make_unique<BasePipeServer>(clientConnection, echoPackets);
}
-} // namespace armnnProfiling
\ No newline at end of file
+} // namespace pipe
+} // namespace arm
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
-#include <ConnectionHandler.hpp>
+#include <server/include/basePipeServer/ConnectionHandler.hpp>
#include <SocketProfilingConnection.hpp>
#include <Processes.hpp>
BOOST_AUTO_TEST_SUITE(BasePipeServerTests)
using namespace armnn;
-using namespace armnnProfiling;
+using namespace arm::pipe;
BOOST_AUTO_TEST_CASE(BasePipeServerTest)
{
// The socket should close once we leave the scope of BOOST_CHECK_NO_THROW
// and socketProfilingConnection should fail to connect
BOOST_CHECK_THROW(profiling::SocketProfilingConnection socketProfilingConnection,
- armnnProfiling::SocketConnectionException);
+ arm::pipe::SocketConnectionException);
// Try to initialize a listening socket through the ConnectionHandler again
ConnectionHandler connectionHandler(udsNamespace, true);
--- /dev/null
+#
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+# SPDX-License-Identifier: MIT
+#
+
+if(BUILD_TIMELINE_DECODER)
+ set(timelineDecoder_sources)
+ list(APPEND timelineDecoder_sources
+ TimelineCaptureCommandHandler.cpp
+ TimelineDecoder.cpp
+ TimelineDirectoryCaptureCommandHandler.cpp)
+
+ include_directories(${PROJECT_SOURCE_DIR}/profiling/common/include)
+
+ if(BUILD_UNIT_TESTS)
+ include_directories(${PROJECT_SOURCE_DIR}/src/profiling
+ ${PROJECT_SOURCE_DIR}/src/armnnUtils)
+ target_include_directories(UnitTests PRIVATE ${PROJECT_SOURCE_DIR}/profiling/server/include/timelineDecoder)
+ endif()
+
+
+ if (BUILD_STATIC_PIPE_LIBS)
+ add_library_ex(timelineDecoder STATIC ${timelineDecoder_sources})
+ target_link_libraries(timelineDecoder pipeCommon)
+
+ if ("${CMAKE_SYSTEM_NAME}" STREQUAL Windows)
+ target_link_libraries(timelineDecoder ws2_32.lib)
+ endif()
+ else()
+ add_library_ex(timelineDecoder SHARED ${timelineDecoder_sources})
+ target_link_libraries(timelineDecoder pipeCommon)
+
+ if ("${CMAKE_SYSTEM_NAME}" STREQUAL Windows)
+ target_link_libraries(timelineDecoder ws2_32.lib)
+ endif()
+
+ set_target_properties(timelineDecoder PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
+ set_target_properties(timelineDecoder PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
+
+ install(TARGETS timelineDecoder
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ endif()
+endif()
// SPDX-License-Identifier: MIT
//
-#include "TimelineCaptureCommandHandler.hpp"
+#include <common/include/CommonProfilingUtils.hpp>
+#include <common/include/Logging.hpp>
+#include <server/include/timelineDecoder/TimelineCaptureCommandHandler.hpp>
#include <string>
-#include <armnn/Logging.hpp>
-namespace armnn
+
+namespace arm
{
-namespace timelinedecoder
+namespace pipe
{
//Array of member functions, the array index matches the decl_id
m_ThreadIdSize = size;
}
-void TimelineCaptureCommandHandler::operator()(const profiling::Packet& packet)
+void TimelineCaptureCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ParseData(packet);
}
-void TimelineCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
+void TimelineCaptureCommandHandler::ParseData(const arm::pipe::Packet& packet)
{
uint32_t offset = 0;
m_PacketLength = packet.GetLength();
// if it not set in the constructor
if (m_ThreadIdSize == 0)
{
- ARMNN_LOG(error) << "TimelineCaptureCommandHandler: m_ThreadIdSize has not been set";
+ ARM_PIPE_LOG(error) << "TimelineCaptureCommandHandler: m_ThreadIdSize has not been set";
return;
}
while ( offset < m_PacketLength )
{
- declId = profiling::ReadUint32(data, offset);
+ declId = arm::pipe::ReadUint32(data, offset);
offset += uint32_t_size;
ITimelineDecoder::TimelineStatus status = (this->*m_ReadFunctions[declId])(data, offset);
if (status == ITimelineDecoder::TimelineStatus::TimelineStatus_Fail)
{
- ARMNN_LOG(error) << "Decode of timeline message type [" << declId <<
+ ARM_PIPE_LOG(error) << "Decode of timeline message type [" << declId <<
"] at offset [" << offset << "] failed";
break;
}
ITimelineDecoder::TimelineStatus TimelineCaptureCommandHandler::ReadLabel(const unsigned char* data, uint32_t& offset)
{
ITimelineDecoder::Label label;
- label.m_Guid = profiling::ReadUint64(data, offset);
+ label.m_Guid = arm::pipe::ReadUint64(data, offset);
offset += uint64_t_size;
- uint32_t nameLength = profiling::ReadUint32(data, offset);
+ uint32_t nameLength = arm::pipe::ReadUint32(data, offset);
offset += uint32_t_size;
uint32_t i = 0;
// nameLength - 1 to account for null operator \0
for ( i = 0; i < nameLength - 1; ++i )
{
- label.m_Name += static_cast<char>(profiling::ReadUint8(data, offset + i));
+ label.m_Name += static_cast<char>(arm::pipe::ReadUint8(data, offset + i));
}
// Shift offset past nameLength
uint32_t uint32WordAmount = (nameLength / uint32_t_size) + (nameLength % uint32_t_size != 0 ? 1 : 0);
const unsigned char* data, uint32_t& offset)
{
ITimelineDecoder::Entity entity;
- entity.m_Guid = profiling::ReadUint64(data, offset);
+ entity.m_Guid = arm::pipe::ReadUint64(data, offset);
offset += uint64_t_size;
return m_TimelineDecoder.CreateEntity(entity);
}
const unsigned char* data, uint32_t& offset)
{
ITimelineDecoder::EventClass eventClass;
- eventClass.m_Guid = profiling::ReadUint64(data, offset);
+ eventClass.m_Guid = arm::pipe::ReadUint64(data, offset);
offset += uint64_t_size;
- eventClass.m_NameGuid = profiling::ReadUint64(data, offset);
+ eventClass.m_NameGuid = arm::pipe::ReadUint64(data, offset);
offset += uint64_t_size;
return m_TimelineDecoder.CreateEventClass(eventClass);
}
{
ITimelineDecoder::Relationship relationship;
relationship.m_RelationshipType =
- static_cast<ITimelineDecoder::RelationshipType>(profiling::ReadUint32(data, offset));
+ static_cast<ITimelineDecoder::RelationshipType>(arm::pipe::ReadUint32(data, offset));
offset += uint32_t_size;
- relationship.m_Guid = profiling::ReadUint64(data, offset);
+ relationship.m_Guid = arm::pipe::ReadUint64(data, offset);
offset += uint64_t_size;
- relationship.m_HeadGuid = profiling::ReadUint64(data, offset);
+ relationship.m_HeadGuid = arm::pipe::ReadUint64(data, offset);
offset += uint64_t_size;
- relationship.m_TailGuid = profiling::ReadUint64(data, offset);
+ relationship.m_TailGuid = arm::pipe::ReadUint64(data, offset);
offset += uint64_t_size;
- relationship.m_AttributeGuid = profiling::ReadUint64(data, offset);
+ relationship.m_AttributeGuid = arm::pipe::ReadUint64(data, offset);
offset += uint64_t_size;
return m_TimelineDecoder.CreateRelationship(relationship);
const unsigned char* data, uint32_t& offset)
{
ITimelineDecoder::Event event;
- event.m_TimeStamp = profiling::ReadUint64(data, offset);
+ event.m_TimeStamp = arm::pipe::ReadUint64(data, offset);
offset += uint64_t_size;
if ( m_ThreadIdSize == 4 )
{
- event.m_ThreadId = profiling::ReadUint32(data, offset);
+ event.m_ThreadId = arm::pipe::ReadUint32(data, offset);
}
else if ( m_ThreadIdSize == 8 )
{
- event.m_ThreadId = profiling::ReadUint64(data, offset);
+ event.m_ThreadId = arm::pipe::ReadUint64(data, offset);
}
offset += m_ThreadIdSize;
- event.m_Guid = profiling::ReadUint64(data, offset);
+ event.m_Guid = arm::pipe::ReadUint64(data, offset);
offset += uint64_t_size;
return m_TimelineDecoder.CreateEvent(event);
}
-} //namespace gatordmock
+} //namespace pipe
-} //namespace armnn
+} //namespace arm
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
-#include "TimelineDecoder.hpp"
-#include <ProfilingUtils.hpp>
+#include <common/include/CommonProfilingUtils.hpp>
+#include <server/include/timelineDecoder/TimelineDecoder.hpp>
+
#include <iostream>
+#include <sstream>
-namespace armnn
+namespace arm
{
-namespace timelinedecoder
+namespace pipe
{
TimelineDecoder::TimelineStatus TimelineDecoder::CreateEntity(const Entity &entity)
{
std::string header;
- header.append(profiling::CentreAlignFormatting("guid", 12));
+ header.append(arm::pipe::CentreAlignFormatting("guid", 12));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("value", 30));
+ header.append(arm::pipe::CentreAlignFormatting("value", 30));
header.append("\n");
std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("LABELS", static_cast<int>(header.size()));
+ std::cout << arm::pipe::CentreAlignFormatting("LABELS", static_cast<int>(header.size()));
std::cout << "\n";
std::cout << std::string(header.size(), '=') << "\n";
std::cout << header;
{
std::string body;
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Labels[i].m_Guid), 12));
+ body.append(arm::pipe::CentreAlignFormatting(std::to_string(m_Model.m_Labels[i].m_Guid), 12));
body.append(" | ");
- body.append(profiling::CentreAlignFormatting(m_Model.m_Labels[i].m_Name, 30));
+ body.append(arm::pipe::CentreAlignFormatting(m_Model.m_Labels[i].m_Name, 30));
body.append("\n");
std::cout << std::string(body.size(), '-') << "\n";
void TimelineDecoder::printEntities()
{
std::string header;
- header.append(profiling::CentreAlignFormatting("guid", 12));
+ header.append(arm::pipe::CentreAlignFormatting("guid", 12));
header.append("\n");
std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("ENTITIES", static_cast<int>(header.size()));
+ std::cout << arm::pipe::CentreAlignFormatting("ENTITIES", static_cast<int>(header.size()));
std::cout << "\n";
std::cout << std::string(header.size(), '=') << "\n";
std::cout << header;
{
std::string body;
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Entities[i].m_Guid), 12));
+ body.append(arm::pipe::CentreAlignFormatting(std::to_string(m_Model.m_Entities[i].m_Guid), 12));
body.append("\n");
std::cout << std::string(body.size(), '-') << "\n";
void TimelineDecoder::printEventClasses()
{
std::string header;
- header.append(profiling::CentreAlignFormatting("guid", 12));
+ header.append(arm::pipe::CentreAlignFormatting("guid", 12));
header.append("\n");
std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("EVENT CLASSES", static_cast<int>(header.size()));
+ std::cout << arm::pipe::CentreAlignFormatting("EVENT CLASSES", static_cast<int>(header.size()));
std::cout << "\n";
std::cout << std::string(header.size(), '=') << "\n";
std::cout << header;
{
std::string body;
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_EventClasses[i].m_Guid), 12));
+ body.append(arm::pipe::CentreAlignFormatting(std::to_string(m_Model.m_EventClasses[i].m_Guid), 12));
body.append("\n");
std::cout << std::string(body.size(), '-') << "\n";
{
std::string header;
- header.append(profiling::CentreAlignFormatting("timestamp", 12));
+ header.append(arm::pipe::CentreAlignFormatting("timestamp", 12));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("threadId", 12));
+ header.append(arm::pipe::CentreAlignFormatting("threadId", 12));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("eventGuid", 12));
+ header.append(arm::pipe::CentreAlignFormatting("eventGuid", 12));
header.append("\n");
std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("EVENTS", static_cast<int>(header.size()));
+ std::cout << arm::pipe::CentreAlignFormatting("EVENTS", static_cast<int>(header.size()));
std::cout << "\n";
std::cout << std::string(header.size(), '=') << "\n";
std::cout << header;
{
std::string body;
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Events[i].m_TimeStamp), 12));
+ body.append(arm::pipe::CentreAlignFormatting(std::to_string(m_Model.m_Events[i].m_TimeStamp), 12));
body.append(" | ");
std::stringstream ss;
ss << m_Model.m_Events[i].m_ThreadId;
std::string threadId = ss.str();;
- body.append(profiling::CentreAlignFormatting(threadId, 12));
+ body.append(arm::pipe::CentreAlignFormatting(threadId, 12));
body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Events[i].m_Guid), 12));
+ body.append(arm::pipe::CentreAlignFormatting(std::to_string(m_Model.m_Events[i].m_Guid), 12));
body.append("\n");
std::cout << std::string(body.size(), '-') << "\n";
void TimelineDecoder::printRelationships()
{
std::string header;
- header.append(profiling::CentreAlignFormatting("relationshipType", 20));
+ header.append(arm::pipe::CentreAlignFormatting("relationshipType", 20));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("relationshipGuid", 20));
+ header.append(arm::pipe::CentreAlignFormatting("relationshipGuid", 20));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("headGuid", 12));
+ header.append(arm::pipe::CentreAlignFormatting("headGuid", 12));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("tailGuid", 12));
+ header.append(arm::pipe::CentreAlignFormatting("tailGuid", 12));
header.append("\n");
std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("RELATIONSHIPS", static_cast<int>(header.size()));
+ std::cout << arm::pipe::CentreAlignFormatting("RELATIONSHIPS", static_cast<int>(header.size()));
std::cout << "\n";
std::cout << std::string(header.size(), '=') << "\n";
std::cout << header;
std::string body;
body.append(
- profiling::CentreAlignFormatting(std::to_string(static_cast<unsigned int>
+ arm::pipe::CentreAlignFormatting(std::to_string(static_cast<unsigned int>
(m_Model.m_Relationships[i].m_RelationshipType)),
20));
body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Relationships[i].m_Guid), 20));
+ body.append(arm::pipe::CentreAlignFormatting(std::to_string(m_Model.m_Relationships[i].m_Guid), 20));
body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Relationships[i].m_HeadGuid), 12));
+ body.append(arm::pipe::CentreAlignFormatting(std::to_string(m_Model.m_Relationships[i].m_HeadGuid), 12));
body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Relationships[i].m_TailGuid), 12));
+ body.append(arm::pipe::CentreAlignFormatting(std::to_string(m_Model.m_Relationships[i].m_TailGuid), 12));
body.append(" | ");
body.append("\n");
std::cout << body;
}
}
-}
-}
\ No newline at end of file
+
+} // namespace pipe
+} // namespace arm
\ No newline at end of file
// SPDX-License-Identifier: MIT
//
-#include "TimelineDirectoryCaptureCommandHandler.hpp"
-#include "TimelineCaptureCommandHandler.hpp"
+#include <common/include/CommonProfilingUtils.hpp>
+#include <common/include/SwTrace.hpp>
+#include <server/include/timelineDecoder/TimelineCaptureCommandHandler.hpp>
+#include <server/include/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp>
#include <iostream>
#include <string>
-using namespace armnn::profiling;
-
-namespace armnn
+namespace arm
{
-namespace timelinedecoder
+namespace pipe
{
-void TimelineDirectoryCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
+void TimelineDirectoryCaptureCommandHandler::ParseData(const arm::pipe::Packet& packet)
{
uint32_t offset = 0;
m_SwTraceHeader.m_ThreadIdBytes = ReadUint8(data, offset);
offset += uint8_t_size;
- uint32_t numberOfDeclarations = profiling::ReadUint32(data, offset);
+ uint32_t numberOfDeclarations = arm::pipe::ReadUint32(data, offset);
offset += uint32_t_size;
for (uint32_t declaration = 0; declaration < numberOfDeclarations; ++declaration)
{
- m_SwTraceMessages.push_back(profiling::ReadSwTraceMessage(data, offset, packet.GetLength()));
+ m_SwTraceMessages.push_back(arm::pipe::ReadSwTraceMessage(data, offset, packet.GetLength()));
}
m_TimelineCaptureCommandHandler.SetThreadIdSize(m_SwTraceHeader.m_ThreadIdBytes);
{
std::string header;
- header.append(profiling::CentreAlignFormatting("decl_id", 12));
+ header.append(arm::pipe::CentreAlignFormatting("decl_id", 12));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("decl_name", 20));
+ header.append(arm::pipe::CentreAlignFormatting("decl_name", 20));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("ui_name", 20));
+ header.append(arm::pipe::CentreAlignFormatting("ui_name", 20));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("arg_types", 16));
+ header.append(arm::pipe::CentreAlignFormatting("arg_types", 16));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("arg_names", 80));
+ header.append(arm::pipe::CentreAlignFormatting("arg_names", 80));
header.append("\n");
std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("SW DIRECTORY", static_cast<int>(header.size()));
+ std::cout << arm::pipe::CentreAlignFormatting("SW DIRECTORY", static_cast<int>(header.size()));
std::cout << "\n";
std::cout << std::string(header.size(), '=') << "\n";
{
std::string body;
- body.append(profiling::CentreAlignFormatting(std::to_string(swTraceMessage.m_Id), 12));
+ body.append(arm::pipe::CentreAlignFormatting(std::to_string(swTraceMessage.m_Id), 12));
body.append(" | ");
- body.append(profiling::CentreAlignFormatting(swTraceMessage.m_Name, 20));
+ body.append(arm::pipe::CentreAlignFormatting(swTraceMessage.m_Name, 20));
body.append(" | ");
- body.append(profiling::CentreAlignFormatting(swTraceMessage.m_UiName, 20));
+ body.append(arm::pipe::CentreAlignFormatting(swTraceMessage.m_UiName, 20));
body.append(" | ");
std::string argTypes;
argTypes += argType;
argTypes += " ";
}
- body.append(profiling::CentreAlignFormatting(argTypes, 16));
+ body.append(arm::pipe::CentreAlignFormatting(argTypes, 16));
body.append(" | ");
std::string argNames;
{
argNames += argName + " ";
}
- body.append(profiling::CentreAlignFormatting(argNames, 80));
+ body.append(arm::pipe::CentreAlignFormatting(argNames, 80));
body.append("\n");
}
}
-void TimelineDirectoryCaptureCommandHandler::operator()(const profiling::Packet& packet)
+void TimelineDirectoryCaptureCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ParseData(packet);
}
}
-} //namespace gatordmock
-
-} //namespace armnn
+} //namespace pipe
+} //namespace arm
// SPDX-License-Identifier: MIT
//
-#include <TimelineCaptureCommandHandler.hpp>
-#include <TimelineDirectoryCaptureCommandHandler.hpp>
-#include <TimelineDecoder.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/CommonProfilingUtils.hpp>
+#include <server/include/timelineDecoder/TimelineCaptureCommandHandler.hpp>
+#include <server/include/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp>
+#include <server/include/timelineDecoder/TimelineDecoder.hpp>
-#include <CommandHandlerFunctor.hpp>
+#include <BufferManager.hpp>
#include <Threads.hpp>
#include <ProfilingService.hpp>
#include <PacketBuffer.hpp>
BOOST_AUTO_TEST_SUITE(TimelineDecoderTests)
-using namespace armnn;
-using namespace timelinedecoder;
-
void SendTimelinePacketToCommandHandler(const unsigned char* packetBuffer,
- profiling::CommandHandlerFunctor &CommandHandler)
+ arm::pipe::CommandHandlerFunctor& CommandHandler)
{
uint32_t uint32_t_size = sizeof(uint32_t);
unsigned int offset = 0;
uint32_t header[2];
- header[0] = profiling::ReadUint32(packetBuffer, offset);
+ header[0] = arm::pipe::ReadUint32(packetBuffer, offset);
offset += uint32_t_size;
- header[1] = profiling::ReadUint32(packetBuffer, offset);
+ header[1] = arm::pipe::ReadUint32(packetBuffer, offset);
offset += uint32_t_size;
uint32_t PacketDataLength = header[1] & 0x00FFFFFF;
auto uniquePacketData = std::make_unique<unsigned char[]>(PacketDataLength);
std::memcpy(uniquePacketData.get(), packetBuffer + offset, PacketDataLength);
- armnn::profiling::Packet packet(header[0], PacketDataLength, uniquePacketData);
+ arm::pipe::Packet packet(header[0], PacketDataLength, uniquePacketData);
BOOST_CHECK(std::memcmp(packetBuffer + offset, packet.GetData(), packet.GetLength()) == 0);
CommandHandler(packet);
}
-void PushEntity(TimelineDecoder::Model& model, const ITimelineDecoder::Entity entity)
+void PushEntity(arm::pipe::TimelineDecoder::Model& model, const arm::pipe::ITimelineDecoder::Entity entity)
{
model.m_Entities.emplace_back(entity);
}
-void PushEventClass(TimelineDecoder::Model& model, const ITimelineDecoder::EventClass eventClass)
+void PushEventClass(arm::pipe::TimelineDecoder::Model& model, const arm::pipe::ITimelineDecoder::EventClass eventClass)
{
model.m_EventClasses.emplace_back(eventClass);
}
-void PushEvent(TimelineDecoder::Model& model, const ITimelineDecoder::Event event)
+void PushEvent(arm::pipe::TimelineDecoder::Model& model, const arm::pipe::ITimelineDecoder::Event event)
{
model.m_Events.emplace_back(event);
}
-void PushLabel(TimelineDecoder::Model& model, const ITimelineDecoder::Label label)
+void PushLabel(arm::pipe::TimelineDecoder::Model& model, const arm::pipe::ITimelineDecoder::Label label)
{
model.m_Labels.emplace_back(label);
}
-void PushRelationship(TimelineDecoder::Model& model, const ITimelineDecoder::Relationship relationship)
+void PushRelationship(arm::pipe::TimelineDecoder::Model& model,
+ const arm::pipe::ITimelineDecoder::Relationship relationship)
{
model.m_Relationships.emplace_back(relationship);
}
uint32_t uint32_t_size = sizeof(uint32_t);
uint32_t uint64_t_size = sizeof(uint64_t);
- profiling::BufferManager bufferManager(5);
- profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
+ armnn::profiling::BufferManager bufferManager(5);
+ armnn::profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
- std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
+ std::unique_ptr<armnn::profiling::ISendTimelinePacket> sendTimelinePacket =
timelinePacketWriterFactory.GetSendTimelinePacket();
- profiling::PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
- TimelineDecoder timelineDecoder;
- TimelineCaptureCommandHandler timelineCaptureCommandHandler(
+ arm::pipe::TimelineDecoder timelineDecoder;
+ arm::pipe::TimelineCaptureCommandHandler timelineCaptureCommandHandler(
1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder);
- TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
+ arm::pipe::TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
1, 0, packetVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(),
timelineCaptureCommandHandler, true);
sendTimelinePacket->SendTimelineMessageDirectoryPackage();
sendTimelinePacket->Commit();
- std::vector<profiling::SwTraceMessage> swTraceBufferMessages;
+ std::vector<arm::pipe::SwTraceMessage> swTraceBufferMessages;
unsigned int offset = uint32_t_size * 2;
- std::unique_ptr<profiling::IPacketBuffer> packetBuffer = bufferManager.GetReadableBuffer();
+ std::unique_ptr<armnn::profiling::IPacketBuffer> packetBuffer = bufferManager.GetReadableBuffer();
uint8_t readStreamVersion = ReadUint8(packetBuffer, offset);
BOOST_CHECK(readStreamVersion == 4);
BOOST_CHECK(readThreadIdBytes == armnn::profiling::ThreadIdSize);
offset += uint8_t_size;
- uint32_t declarationSize = profiling::ReadUint32(packetBuffer, offset);
+ uint32_t declarationSize = arm::pipe::ReadUint32(packetBuffer->GetReadableData(), offset);
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 = timelineDirectoryCaptureCommandHandler.m_SwTraceMessages[index];
+ arm::pipe::SwTraceMessage& bufferMessage = swTraceBufferMessages[index];
+ arm::pipe::SwTraceMessage& handlerMessage = timelineDirectoryCaptureCommandHandler.m_SwTraceMessages[index];
BOOST_CHECK(bufferMessage.m_Name == handlerMessage.m_Name);
BOOST_CHECK(bufferMessage.m_UiName == handlerMessage.m_UiName);
BOOST_AUTO_TEST_CASE(TimelineCaptureTest)
{
- profiling::BufferManager bufferManager(50);
- profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
+ armnn::profiling::BufferManager bufferManager(50);
+ armnn::profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
- std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
+ std::unique_ptr<armnn::profiling::ISendTimelinePacket> sendTimelinePacket =
timelinePacketWriterFactory.GetSendTimelinePacket();
- profiling::PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
- TimelineDecoder timelineDecoder;
- const TimelineDecoder::Model& model = timelineDecoder.GetModel();
+ arm::pipe::TimelineDecoder timelineDecoder;
+ const arm::pipe::TimelineDecoder::Model& model = timelineDecoder.GetModel();
- TimelineCaptureCommandHandler timelineCaptureCommandHandler(
+ arm::pipe::TimelineCaptureCommandHandler timelineCaptureCommandHandler(
1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder,
armnn::profiling::ThreadIdSize);
- using Status = ITimelineDecoder::TimelineStatus;
+ using Status = arm::pipe::ITimelineDecoder::TimelineStatus;
BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success);
BOOST_CHECK(timelineDecoder.SetEventClassCallback(PushEventClass) == Status::TimelineStatus_Success);
BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent) == Status::TimelineStatus_Success);
unsigned char* uCharThreadId = new unsigned char[armnn::profiling::ThreadIdSize]();;
uint64_t uint64ThreadId;
- profiling::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize);
+ arm::pipe::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize);
if (armnn::profiling::ThreadIdSize == 4)
{
- uint64ThreadId = profiling::ReadUint32(uCharThreadId, 0);
+ uint64ThreadId = arm::pipe::ReadUint32(uCharThreadId, 0);
}
else if (armnn::profiling::ThreadIdSize == 8)
{
- uint64ThreadId = profiling::ReadUint64(uCharThreadId, 0);
+ uint64ThreadId = arm::pipe::ReadUint64(uCharThreadId, 0);
}
delete[] uCharThreadId;
timelineCaptureCommandHandler);
// Send relationship
- profiling::ProfilingRelationshipType relationshipType = profiling::ProfilingRelationshipType::DataLink;
+ armnn::profiling::ProfilingRelationshipType relationshipType =
+ armnn::profiling::ProfilingRelationshipType::DataLink;
sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
relationshipGuid,
headGuid,
BOOST_CHECK(model.m_Labels[i].m_Guid == labelGuid);
BOOST_CHECK(model.m_Labels[i].m_Name == labelName);
- BOOST_CHECK(model.m_Relationships[i].m_RelationshipType == ITimelineDecoder::RelationshipType::DataLink);
+ BOOST_CHECK(model.m_Relationships[i].m_RelationshipType ==
+ arm::pipe::ITimelineDecoder::RelationshipType::DataLink);
BOOST_CHECK(model.m_Relationships[i].m_Guid == relationshipGuid);
BOOST_CHECK(model.m_Relationships[i].m_HeadGuid == headGuid);
BOOST_CHECK(model.m_Relationships[i].m_TailGuid == tailGuid);
BOOST_AUTO_TEST_CASE(TimelineCaptureTestMultipleStringsInBuffer)
{
- profiling::BufferManager bufferManager(50);
- profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
+ armnn::profiling::BufferManager bufferManager(50);
+ armnn::profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
- std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
+ std::unique_ptr<armnn::profiling::ISendTimelinePacket> sendTimelinePacket =
timelinePacketWriterFactory.GetSendTimelinePacket();
- profiling::PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
- TimelineDecoder timelineDecoder;
- const TimelineDecoder::Model& model = timelineDecoder.GetModel();
+ arm::pipe::TimelineDecoder timelineDecoder;
+ const arm::pipe::TimelineDecoder::Model& model = timelineDecoder.GetModel();
- TimelineCaptureCommandHandler timelineCaptureCommandHandler(
+ arm::pipe::TimelineCaptureCommandHandler timelineCaptureCommandHandler(
1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder,
armnn::profiling::ThreadIdSize);
- using Status = ITimelineDecoder::TimelineStatus;
+ using Status = arm::pipe::TimelineDecoder::TimelineStatus;
BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success);
BOOST_CHECK(timelineDecoder.SetEventClassCallback(PushEventClass) == Status::TimelineStatus_Success);
BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent) == Status::TimelineStatus_Success);
unsigned char* uCharThreadId = new unsigned char[armnn::profiling::ThreadIdSize]();
uint64_t uint64ThreadId;
- profiling::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize);
+ arm::pipe::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize);
if ( armnn::profiling::ThreadIdSize == 4 )
{
- uint64ThreadId = profiling::ReadUint32(uCharThreadId, 0);
+ uint64ThreadId = arm::pipe::ReadUint32(uCharThreadId, 0);
}
else if ( armnn::profiling::ThreadIdSize == 8 )
{
- uint64ThreadId = profiling::ReadUint64(uCharThreadId, 0);
+ uint64ThreadId = arm::pipe::ReadUint64(uCharThreadId, 0);
}
delete[] uCharThreadId;
sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName2);
sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName3);
// Send relationship
- profiling::ProfilingRelationshipType relationshipType = profiling::ProfilingRelationshipType::DataLink;
+ armnn::profiling::ProfilingRelationshipType relationshipType =
+ armnn::profiling::ProfilingRelationshipType::DataLink;
sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
relationshipGuid,
headGuid,
BOOST_CHECK(model.m_Events[i].m_ThreadId == uint64ThreadId);
BOOST_CHECK(model.m_Events[i].m_Guid == eventGuid);
- BOOST_CHECK(model.m_Relationships[i].m_RelationshipType == ITimelineDecoder::RelationshipType::DataLink);
+ BOOST_CHECK(model.m_Relationships[i].m_RelationshipType ==
+ arm::pipe::ITimelineDecoder::RelationshipType::DataLink);
BOOST_CHECK(model.m_Relationships[i].m_Guid == relationshipGuid);
BOOST_CHECK(model.m_Relationships[i].m_HeadGuid == headGuid);
BOOST_CHECK(model.m_Relationships[i].m_TailGuid == tailGuid);
--- /dev/null
+#
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+# SPDX-License-Identifier: MIT
+#
+
+# toolchain file for building for Windows on an Ubuntu Linux system.
+#
+# Typical usage:
+# *) install cross compiler: `sudo apt-get install mingw-w64`
+# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/toolchain-x86-ubuntu-mingw64.cmake
+
+set(CMAKE_SYSTEM_NAME Windows)
+set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
+
+# cross compilers to use for C and C++
+set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
+set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
+
+# target environment on the build host system
+# set 1st to dir with the cross compiler's C/C++ headers/libs
+set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
+
+# modify default behavior of FIND_XXX() commands to
+# search for headers/libs in the target environment and
+# search for programs in the build host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include <armnn/utility/Assert.hpp>
#if defined(_MSC_VER)
-#include <WindowsWrapper.hpp>
+#include <commons/include/WindowsWrapper.hpp>
#endif
#if defined(__ANDROID__)
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#define BOOST_TEST_MODULE UnitTests
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/tee.hpp>
#include <iostream>
-#include <WindowsWrapper.hpp>
+#include <commons/include/WindowsWrapper.hpp>
using namespace boost::iostreams;
using namespace std;
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#if defined(__unix__) || defined(__APPLE__)
#include <unistd.h>
#elif defined(_MSC_VER)
-#include "WindowsWrapper.hpp"
+#include <commons/include/WindowsWrapper.hpp>
#endif
namespace armnnUtils
#include <sys/syscall.h>
#define gettid() syscall(SYS_gettid)
#elif defined(_MSC_VER)
-#include "WindowsWrapper.hpp"
+#include <commons/include/WindowsWrapper.hpp>
#elif defined(__APPLE__)
#include "AvailabilityMacros.h"
#include <sys/syscall.h>
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
std::vector<Timestamp> m_timestamps;
};
-Packet PacketWriter(uint32_t period, std::vector<uint16_t> countervalues)
+arm::pipe::Packet PacketWriter(uint32_t period, std::vector<uint16_t> countervalues)
{
const uint32_t packetId = 0x40000;
uint32_t offset = 0;
BOOST_AUTO_TEST_CASE(TestBackendCounters)
{
Holder holder;
- PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
ProfilingStateMachine stateMachine;
ReadCounterVals readCounterVals;
CounterIdMap counterIdMap;
};
Holder holder;
- PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
ProfilingStateMachine stateMachine;
ReadCounterVals readCounterVals;
StreamRedirector redirect(std::cout, ss.rdbuf());
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
namespace profiling
{
-void ActivateTimelineReportingCommandHandler::operator()(const Packet& packet)
+void ActivateTimelineReportingCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include "CommandHandlerFunctor.hpp"
#include "ProfilingStateMachine.hpp"
#include "SendTimelinePacket.hpp"
#include "IReportStructure.hpp"
#include "armnn/Optional.hpp"
-#include <Packet.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
namespace armnn
namespace profiling
{
-class ActivateTimelineReportingCommandHandler : public CommandHandlerFunctor
+class ActivateTimelineReportingCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
ActivateTimelineReportingCommandHandler(uint32_t familyId,
m_ReportStructure(reportStructure)
{}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
SendTimelinePacket& m_SendTimelinePacket;
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
{
try
{
- Packet packet = profilingConnection.ReadPacket(m_Timeout.load());
+ arm::pipe::Packet packet = profilingConnection.ReadPacket(m_Timeout.load());
if (packet.IsEmpty())
{
continue;
}
- Version version = m_PacketVersionResolver.ResolvePacketVersion(packet.GetPacketFamily(),
- packet.GetPacketId());
+ arm::pipe::Version version = m_PacketVersionResolver.ResolvePacketVersion(packet.GetPacketFamily(),
+ packet.GetPacketId());
- CommandHandlerFunctor* commandHandlerFunctor =
- m_CommandHandlerRegistry.GetFunctor(packet.GetPacketFamily(),
- packet.GetPacketId(),
+ arm::pipe::CommandHandlerFunctor* commandHandlerFunctor =
+ m_CommandHandlerRegistry.GetFunctor(packet.GetPacketFamily(),
+ packet.GetPacketId(),
version.GetEncodedValue());
ARMNN_ASSERT(commandHandlerFunctor);
commandHandlerFunctor->operator()(packet);
m_KeepRunning.store(false);
}
}
+ catch (const arm::pipe::ProfilingException& e)
+ {
+ // Log the error and continue
+ ARMNN_LOG(warning) << "An error has occurred when handling a command: " << e.what();
+ // Did we get here because the socket failed?
+ if ( !profilingConnection.IsOpen() )
+ {
+ // We're going to stop processing commands.
+ // This will leave the thread idle. There is no mechanism to restart the profiling service when the
+ // connection is lost.
+ m_KeepRunning.store(false);
+ }
+ }
catch (const Exception& e)
{
// Log the error and continue
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include "CommandHandlerRegistry.hpp"
#include "IProfilingConnection.hpp"
-#include "PacketVersionResolver.hpp"
+#include <common/include/PacketVersionResolver.hpp>
+
+#include <common/include/CommandHandlerRegistry.hpp>
#include <atomic>
#include <thread>
public:
CommandHandler(uint32_t timeout,
bool stopAfterTimeout,
- CommandHandlerRegistry& commandHandlerRegistry,
- PacketVersionResolver& packetVersionResolver)
+ arm::pipe::CommandHandlerRegistry& commandHandlerRegistry,
+ arm::pipe::PacketVersionResolver& packetVersionResolver)
: m_Timeout(timeout),
m_StopAfterTimeout(stopAfterTimeout),
m_IsRunning(false),
std::atomic<bool> m_KeepRunning;
std::thread m_CommandThread;
- CommandHandlerRegistry& m_CommandHandlerRegistry;
- PacketVersionResolver& m_PacketVersionResolver;
+ arm::pipe::CommandHandlerRegistry& m_CommandHandlerRegistry;
+ arm::pipe::PacketVersionResolver& m_PacketVersionResolver;
};
} // namespace profiling
namespace profiling
{
-void ConnectionAcknowledgedCommandHandler::operator()(const Packet& packet)
+void ConnectionAcknowledgedCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
switch (currentState)
#pragma once
#include <armnn/backends/profiling/IBackendProfilingContext.hpp>
-#include "CommandHandlerFunctor.hpp"
#include "IProfilingServiceStatus.hpp"
#include "ISendCounterPacket.hpp"
#include "armnn/profiling/ISendTimelinePacket.hpp"
-#include <Packet.hpp>
#include "ProfilingStateMachine.hpp"
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
+
namespace armnn
{
namespace profiling
{
-class ConnectionAcknowledgedCommandHandler final : public CommandHandlerFunctor
+class ConnectionAcknowledgedCommandHandler final : public arm::pipe::CommandHandlerFunctor
{
typedef const std::unordered_map<BackendId, std::shared_ptr<armnn::profiling::IBackendProfilingContext>>&
, m_BackendProfilingContext(backendProfilingContexts)
{}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
void setTimelineEnabled(bool timelineEnabled)
{
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "ProfilingUtils.hpp"
#include <armnn/Exceptions.hpp>
-#include <armnn/Conversion.hpp>
#include <armnn/utility/Assert.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
+#include <common/include/SwTrace.hpp>
+
#include <boost/format.hpp>
namespace armnn
{
// Check that the given category name is valid
if (categoryName.empty() ||
- !IsValidSwTraceString<SwTraceNameCharPolicy>(categoryName))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(categoryName))
{
throw InvalidArgumentException("Trying to register a category with an invalid name");
}
{
// Check that the given device name is valid
if (deviceName.empty() ||
- !IsValidSwTraceString<SwTraceCharPolicy>(deviceName))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>(deviceName))
{
throw InvalidArgumentException("Trying to register a device with an invalid name");
}
{
// Check that the given counter set name is valid
if (counterSetName.empty() ||
- !IsValidSwTraceString<SwTraceNameCharPolicy>(counterSetName))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(counterSetName))
{
throw InvalidArgumentException("Trying to register a counter set with an invalid name");
}
// Check that the given parent category name is valid
if (parentCategoryName.empty() ||
- !IsValidSwTraceString<SwTraceNameCharPolicy>(parentCategoryName))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(parentCategoryName))
{
throw InvalidArgumentException("Trying to register a counter with an invalid parent category name");
}
// Check that the given name is valid
if (name.empty() ||
- !IsValidSwTraceString<SwTraceCharPolicy>(name))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>(name))
{
throw InvalidArgumentException("Trying to register a counter with an invalid name");
}
// Check that the given description is valid
if (description.empty() ||
- !IsValidSwTraceString<SwTraceCharPolicy>(description))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>(description))
{
throw InvalidArgumentException("Trying to register a counter with an invalid description");
}
// Check that the given units are valid
if (units.has_value()
- && !IsValidSwTraceString<SwTraceNameCharPolicy>(units.value()))
+ && !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(units.value()))
{
throw InvalidArgumentException("Trying to register a counter with a invalid units");
}
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include <unordered_set>
#include <unordered_map>
-#include <boost/numeric/conversion/cast.hpp>
+#include <armnn/utility/NumericCast.hpp>
namespace armnn
{
const Optional<uint16_t>& counterSetUid = EmptyOptional()) override;
// Getters for counts
- uint16_t GetCategoryCount() const override { return boost::numeric_cast<uint16_t>(m_Categories.size()); }
- uint16_t GetDeviceCount() const override { return boost::numeric_cast<uint16_t>(m_Devices.size()); }
- uint16_t GetCounterSetCount() const override { return boost::numeric_cast<uint16_t>(m_CounterSets.size()); }
- uint16_t GetCounterCount() const override { return boost::numeric_cast<uint16_t>(m_Counters.size()); }
+ uint16_t GetCategoryCount() const override { return armnn::numeric_cast<uint16_t>(m_Categories.size()); }
+ uint16_t GetDeviceCount() const override { return armnn::numeric_cast<uint16_t>(m_Devices.size()); }
+ uint16_t GetCounterSetCount() const override { return armnn::numeric_cast<uint16_t>(m_CounterSets.size()); }
+ uint16_t GetCounterCount() const override { return armnn::numeric_cast<uint16_t>(m_Counters.size()); }
// Getters for collections
const Categories& GetCategories() const override { return m_Categories; }
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
namespace profiling
{
-void DeactivateTimelineReportingCommandHandler::operator()(const Packet& packet)
+void DeactivateTimelineReportingCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include "CommandHandlerFunctor.hpp"
-#include <Packet.hpp>
#include "ProfilingStateMachine.hpp"
#include "INotifyBackends.hpp"
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
+
namespace armnn
{
namespace profiling
{
-class DeactivateTimelineReportingCommandHandler : public CommandHandlerFunctor
+class DeactivateTimelineReportingCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
, m_BackendNotifier(notifyBackends)
{}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
std::atomic<bool>& m_TimelineReporting;
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
+
#include "DirectoryCaptureCommandHandler.hpp"
#include <armnn/BackendId.hpp>
uint32_t uint16_t_size = sizeof(uint16_t);
uint32_t uint32_t_size = sizeof(uint32_t);
-void DirectoryCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
+void DirectoryCaptureCommandHandler::ParseData(const arm::pipe::Packet& packet)
{
uint16_t categoryRecordCount;
uint16_t counterSetRecordCount;
return eventRecords;
}
-void DirectoryCaptureCommandHandler::operator()(const profiling::Packet& packet)
+void DirectoryCaptureCommandHandler::operator()(const arm::pipe::Packet& packet)
{
if (!m_QuietOperation) // Are we supposed to print to stdout?
{
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include "CommandHandlerFunctor.hpp"
#include "CounterDirectory.hpp"
+#include <common/include/CommandHandlerFunctor.hpp>
+
#include <atomic>
namespace armnn
uint16_t m_MaxCounterUid;
};
-class DirectoryCaptureCommandHandler : public profiling::CommandHandlerFunctor
+class DirectoryCaptureCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
, m_AlreadyParsed(false)
{}
- void operator()(const armnn::profiling::Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
const ICounterDirectory& GetCounterDirectory() const;
}
private:
- void ParseData(const armnn::profiling::Packet& packet);
+ void ParseData(const arm::pipe::Packet& packet);
void ReadCategoryRecords(const unsigned char* data, uint32_t offset, std::vector<uint32_t> categoryOffsets);
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
return headers;
}
-void StreamMetaDataProcessor::HandlePacket(const Packet& packet)
+void StreamMetaDataProcessor::HandlePacket(const arm::pipe::Packet& packet)
{
if (packet.GetHeader() != m_MetaDataPacketHeader)
{
- throw armnnProfiling::ProfilingException("StreamMetaDataProcessor can only handle Stream Meta Data Packets");
+ throw arm::pipe::ProfilingException("StreamMetaDataProcessor can only handle Stream Meta Data Packets");
}
// determine the endianness of the protocol
TargetEndianness endianness;
- if (ToUint32(packet.GetData(),TargetEndianness::BeWire) == armnnProfiling::PIPE_MAGIC)
+ if (ToUint32(packet.GetData(),TargetEndianness::BeWire) == arm::pipe::PIPE_MAGIC)
{
endianness = TargetEndianness::BeWire;
}
- else if (ToUint32(packet.GetData(), TargetEndianness::LeWire) == armnnProfiling::PIPE_MAGIC)
+ else if (ToUint32(packet.GetData(), TargetEndianness::LeWire) == arm::pipe::PIPE_MAGIC)
{
endianness = TargetEndianness::LeWire;
}
else
{
- throw armnnProfiling::ProfilingException("Protocol read error. Unable to read PIPE_MAGIC value.");
+ throw arm::pipe::ProfilingException("Protocol read error. Unable to read the PIPE_MAGIC value.");
}
m_FileOnlyProfilingConnection->SetEndianess(endianness);
// send back the acknowledgement
std::unique_ptr<unsigned char[]> uniqueNullPtr = nullptr;
- Packet returnPacket(0x10000, 0, uniqueNullPtr);
+ arm::pipe::Packet returnPacket(0x10000, 0, uniqueNullPtr);
m_FileOnlyProfilingConnection->ReturnPacket(returnPacket);
}
bool FileOnlyProfilingConnection::WritePacket(const unsigned char* buffer, uint32_t length)
{
ARMNN_ASSERT(buffer);
- Packet packet = ReceivePacket(buffer, length);
+ arm::pipe::Packet packet = ReceivePacket(buffer, length);
ForwardPacketToHandlers(packet);
return true;
}
-void FileOnlyProfilingConnection::ReturnPacket(Packet& packet)
+void FileOnlyProfilingConnection::ReturnPacket(arm::pipe::Packet& packet)
{
{
std::lock_guard<std::mutex> lck(m_PacketAvailableMutex);
m_ConditionPacketAvailable.notify_one();
}
-Packet FileOnlyProfilingConnection::ReadPacket(uint32_t timeout)
+arm::pipe::Packet FileOnlyProfilingConnection::ReadPacket(uint32_t timeout)
{
std::unique_lock<std::mutex> lck(m_PacketAvailableMutex);
std::chrono::milliseconds(timeout),
[&]{return !m_PacketQueue.empty();}))
{
- Packet empty;
+ arm::pipe::Packet empty;
return empty;
}
- Packet returnedPacket = std::move(m_PacketQueue.front());
+ arm::pipe::Packet returnedPacket = std::move(m_PacketQueue.front());
m_PacketQueue.pop();
return returnedPacket;
}
m_LocalHandlersThread = std::thread(&FileOnlyProfilingConnection::ServiceLocalHandlers, this);
}
-void FileOnlyProfilingConnection::ForwardPacketToHandlers(Packet& packet)
+void FileOnlyProfilingConnection::ForwardPacketToHandlers(arm::pipe::Packet& packet)
{
if (m_PacketHandlers.empty())
{
{
do
{
- Packet returnedPacket;
+ arm::pipe::Packet returnedPacket;
bool readPacket = false;
{ // only lock while we are taking the packet off the incoming list
std::unique_lock<std::mutex> lck(m_ReadableMutex);
}
}
-void FileOnlyProfilingConnection::DispatchPacketToHandlers(const Packet& packet)
+void FileOnlyProfilingConnection::DispatchPacketToHandlers(const arm::pipe::Packet& packet)
{
for (auto& delegate : m_UniversalHandlers)
{
{
delegate->HandlePacket(packet);
}
- catch (const armnnProfiling::ProfilingException& ex)
+ catch (const arm::pipe::ProfilingException& ex)
{
Fail(ex.what());
}
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include <armnn/profiling/ILocalPacketHandler.hpp>
#include "DirectoryCaptureCommandHandler.hpp"
#include "IProfilingConnection.hpp"
-#include <Packet.hpp>
#include "ProfilingUtils.hpp"
#include "Runtime.hpp"
+#include <common/include/Packet.hpp>
+
#include <atomic>
#include <condition_variable>
#include <fstream>
std::vector<uint32_t> GetHeadersAccepted() override;
- void HandlePacket(const Packet& packet) override;
+ void HandlePacket(const arm::pipe::Packet& packet) override;
private:
FileOnlyProfilingConnection* m_FileOnlyProfilingConnection;
bool WritePacket(const unsigned char* buffer, uint32_t length) override;
// Sending a packet back to ArmNN.
- Packet ReadPacket(uint32_t timeout) override;
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override;
void SetEndianess(const TargetEndianness& endianness) override //IInternalProfilingConnection
{
m_Endianness = endianness;
}
- void ReturnPacket(Packet& packet) override; //IInternalProfilingConnection
+ void ReturnPacket(arm::pipe::Packet& packet) override; //IInternalProfilingConnection
private:
void AddLocalPacketHandler(ILocalPacketHandlerSharedPtr localPacketHandler);
void StartProcessingThread();
void ClearReadableList();
- void DispatchPacketToHandlers(const Packet& packet);
+ void DispatchPacketToHandlers(const arm::pipe::Packet& packet);
void Fail(const std::string& errorMessage);
- void ForwardPacketToHandlers(Packet& packet);
+ void ForwardPacketToHandlers(arm::pipe::Packet& packet);
void ServiceLocalHandlers();
Runtime::CreationOptions::ExternalProfilingOptions m_Options;
- std::queue<Packet> m_PacketQueue;
+ std::queue<arm::pipe::Packet> m_PacketQueue;
TargetEndianness m_Endianness;
std::mutex m_PacketAvailableMutex;
std::vector<ILocalPacketHandlerSharedPtr> m_UniversalHandlers;
// List of readable packets for the local packet handlers
- std::queue<Packet> m_ReadableList;
+ std::queue<arm::pipe::Packet> m_ReadableList;
// Mutex and condition variable for the readable packet list
std::mutex m_ReadableMutex;
std::condition_variable m_ConditionPacketReadable;
#pragma once
-#include <Packet.hpp>
#include <armnn/profiling/ILocalPacketHandler.hpp>
+#include <common/include/Packet.hpp>
+
#include <cstdint>
namespace armnn
virtual bool WritePacket(const unsigned char* buffer, uint32_t length) = 0;
- virtual Packet ReadPacket(uint32_t timeout) = 0;
+ virtual arm::pipe::Packet ReadPacket(uint32_t timeout) = 0;
};
} // namespace profiling
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "PerJobCounterSelectionCommandHandler.hpp"
+#include <armnn/Exceptions.hpp>
#include <boost/format.hpp>
namespace profiling
{
-void PerJobCounterSelectionCommandHandler::operator()(const Packet& packet)
+void PerJobCounterSelectionCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
switch (currentState)
case ProfilingState::Uninitialised:
case ProfilingState::NotConnected:
case ProfilingState::WaitingForAck:
- throw RuntimeException(boost::str(boost::format("Per-Job Counter Selection Command Handler invoked while in "
- "an wrong state: %1%")
- % GetProfilingStateName(currentState)));
+ throw armnn::RuntimeException(boost::str(boost::format(
+ "Per-Job Counter Selection Command Handler invoked while in an incorrect state: %1%")
+ % GetProfilingStateName(currentState)));
case ProfilingState::Active:
// Process the packet
if (!(packet.GetPacketFamily() == 0u && packet.GetPacketId() == 5u))
break;
default:
- throw RuntimeException(boost::str(boost::format("Unknown profiling service state: %1%")
- % static_cast<int>(currentState)));
+ throw armnn::RuntimeException(boost::str(boost::format("Unknown profiling service state: %1%")
+ % static_cast<int>(currentState)));
}
}
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include <Packet.hpp>
-#include "CommandHandlerFunctor.hpp"
#include "ProfilingStateMachine.hpp"
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
+
namespace armnn
{
namespace profiling
{
-class PerJobCounterSelectionCommandHandler : public CommandHandlerFunctor
+class PerJobCounterSelectionCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
, m_StateMachine(profilingStateMachine)
{}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
const ProfilingStateMachine& m_StateMachine;
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
namespace profiling
{
-void PeriodicCounterSelectionCommandHandler::ParseData(const Packet& packet, CaptureData& captureData)
+void PeriodicCounterSelectionCommandHandler::ParseData(const arm::pipe::Packet& packet, CaptureData& captureData)
{
std::vector<uint16_t> counterIds;
uint32_t sizeOfUint32 = boost::numeric_cast<uint32_t>(sizeof(uint32_t));
captureData.SetCounterIds(counterIds);
}
-void PeriodicCounterSelectionCommandHandler::operator()(const Packet& packet)
+void PeriodicCounterSelectionCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
switch (currentState)
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include "CounterIdMap.hpp"
-#include <Packet.hpp>
-#include "CommandHandlerFunctor.hpp"
#include "Holder.hpp"
#include "ProfilingStateMachine.hpp"
#include "SendCounterPacket.hpp"
#include "armnn/Logging.hpp"
#include "armnn/BackendRegistry.hpp"
-#include <set>
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
+#include <set>
namespace armnn
{
{
-class PeriodicCounterSelectionCommandHandler : public CommandHandlerFunctor
+class PeriodicCounterSelectionCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
<< errorMsg.value();
}
}
- void ParseData(const Packet& packet, CaptureData& captureData);
+ void ParseData(const arm::pipe::Packet& packet, CaptureData& captureData);
std::set<armnn::BackendId> ProcessBackendCounterIds(const uint32_t capturePeriod,
const std::set<uint16_t> newCounterIds,
const std::set<uint16_t> unusedCounterIds);
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
return success;
}
-Packet ProfilingConnectionDumpToFileDecorator::ReadPacket(uint32_t timeout)
+arm::pipe::Packet ProfilingConnectionDumpToFileDecorator::ReadPacket(uint32_t timeout)
{
- Packet packet = m_Connection->ReadPacket(timeout);
+ arm::pipe::Packet packet = m_Connection->ReadPacket(timeout);
if (!m_Options.m_IncomingCaptureFile.empty())
{
DumpIncomingToFile(packet);
/// to write the data into the specified file.
/// @param packet data packet to write
/// @return nothing
-void ProfilingConnectionDumpToFileDecorator::DumpIncomingToFile(const Packet& packet)
+void ProfilingConnectionDumpToFileDecorator::DumpIncomingToFile(const arm::pipe::Packet& packet)
{
bool success = true;
if (!m_IncomingDumpFileStream.is_open())
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
bool WritePacket(const unsigned char* buffer, uint32_t length) override;
- Packet ReadPacket(uint32_t timeout) override;
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override;
private:
bool OpenIncomingDumpFile();
bool OpenOutgoingDumpFile();
- void DumpIncomingToFile(const Packet& packet);
+ void DumpIncomingToFile(const arm::pipe::Packet& packet);
bool DumpOutgoingToFile(const unsigned char* buffer, uint32_t length);
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
ARMNN_LOG(warning) << "An error has occurred when creating the profiling connection: "
<< e.what();
}
- catch (const armnnProfiling::SocketConnectionException& e)
+ catch (const arm::pipe::SocketConnectionException& e)
{
ARMNN_LOG(warning) << "An error has occurred when creating the profiling connection ["
<< e.what() << "] on socket [" << e.GetSocketFd() << "].";
#include "INotifyBackends.hpp"
#include <armnn/backends/profiling/IBackendProfilingContext.hpp>
+#include <list>
+
namespace armnn
{
void CheckCounterUid(uint16_t counterUid) const;
// Profiling service components
- ExternalProfilingOptions m_Options;
- std::atomic<bool> m_TimelineReporting;
- CounterDirectory m_CounterDirectory;
- CounterIdMap m_CounterIdMap;
- IProfilingConnectionFactoryPtr m_ProfilingConnectionFactory;
- IProfilingConnectionPtr m_ProfilingConnection;
- ProfilingStateMachine m_StateMachine;
- CounterIndices m_CounterIndex;
- CounterValues m_CounterValues;
- CommandHandlerRegistry m_CommandHandlerRegistry;
- PacketVersionResolver m_PacketVersionResolver;
- CommandHandler m_CommandHandler;
- BufferManager m_BufferManager;
- SendCounterPacket m_SendCounterPacket;
- SendThread m_SendThread;
- SendTimelinePacket m_SendTimelinePacket;
+ ExternalProfilingOptions m_Options;
+ std::atomic<bool> m_TimelineReporting;
+ CounterDirectory m_CounterDirectory;
+ CounterIdMap m_CounterIdMap;
+ IProfilingConnectionFactoryPtr m_ProfilingConnectionFactory;
+ IProfilingConnectionPtr m_ProfilingConnection;
+ ProfilingStateMachine m_StateMachine;
+ CounterIndices m_CounterIndex;
+ CounterValues m_CounterValues;
+ arm::pipe::CommandHandlerRegistry m_CommandHandlerRegistry;
+ arm::pipe::PacketVersionResolver m_PacketVersionResolver;
+ CommandHandler m_CommandHandler;
+ BufferManager m_BufferManager;
+ SendCounterPacket m_SendCounterPacket;
+ SendThread m_SendThread;
+ SendTimelinePacket m_SendTimelinePacket;
Holder m_Holder;
#include "ProfilingUtils.hpp"
-#include "common/include/ProfilingException.hpp"
+#include <common/include/CommonProfilingUtils.hpp>
+#include <common/include/ProfilingException.hpp>
+#include <common/include/SwTrace.hpp>
#include <armnn/Version.hpp>
void WriteBytes(unsigned char* buffer, unsigned int offset, const void* value, unsigned int valueSize)
{
- ARMNN_ASSERT(buffer);
- ARMNN_ASSERT(value);
-
- for (unsigned int i = 0; i < valueSize; i++, offset++)
- {
- buffer[offset] = *(reinterpret_cast<const unsigned char*>(value) + i);
- }
+ arm::pipe::WriteBytes(buffer, offset, value, valueSize);
}
void WriteUint64(unsigned char* buffer, unsigned int offset, uint64_t value)
{
- ARMNN_ASSERT(buffer);
-
- buffer[offset] = static_cast<unsigned char>(value & 0xFF);
- buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
- buffer[offset + 2] = static_cast<unsigned char>((value >> 16) & 0xFF);
- buffer[offset + 3] = static_cast<unsigned char>((value >> 24) & 0xFF);
- buffer[offset + 4] = static_cast<unsigned char>((value >> 32) & 0xFF);
- buffer[offset + 5] = static_cast<unsigned char>((value >> 40) & 0xFF);
- buffer[offset + 6] = static_cast<unsigned char>((value >> 48) & 0xFF);
- buffer[offset + 7] = static_cast<unsigned char>((value >> 56) & 0xFF);
+ arm::pipe::WriteUint64(buffer, offset, value);
}
void WriteUint32(unsigned char* buffer, unsigned int offset, uint32_t value)
{
- ARMNN_ASSERT(buffer);
-
- buffer[offset] = static_cast<unsigned char>(value & 0xFF);
- buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
- buffer[offset + 2] = static_cast<unsigned char>((value >> 16) & 0xFF);
- buffer[offset + 3] = static_cast<unsigned char>((value >> 24) & 0xFF);
+ arm::pipe::WriteUint32(buffer, offset, value);
}
void WriteUint16(unsigned char* buffer, unsigned int offset, uint16_t value)
{
- ARMNN_ASSERT(buffer);
-
- buffer[offset] = static_cast<unsigned char>(value & 0xFF);
- buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
+ arm::pipe::WriteUint16(buffer, offset, value);
}
void WriteUint8(unsigned char* buffer, unsigned int offset, uint8_t value)
{
- ARMNN_ASSERT(buffer);
-
- buffer[offset] = static_cast<unsigned char>(value);
+ arm::pipe::WriteUint8(buffer, offset, value);
}
void ReadBytes(const IPacketBufferPtr& packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
void ReadBytes(const unsigned char* buffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
{
- ARMNN_ASSERT(buffer);
- ARMNN_ASSERT(outValue);
-
- for (unsigned int i = 0; i < valueSize; i++, offset++)
- {
- outValue[i] = static_cast<uint8_t>(buffer[offset]);
- }
+ arm::pipe::ReadBytes(buffer, offset, valueSize, outValue);
}
uint64_t ReadUint64(const unsigned char* buffer, unsigned int offset)
{
- ARMNN_ASSERT(buffer);
-
- uint64_t value = 0;
- value = static_cast<uint64_t>(buffer[offset]);
- value |= static_cast<uint64_t>(buffer[offset + 1]) << 8;
- value |= static_cast<uint64_t>(buffer[offset + 2]) << 16;
- value |= static_cast<uint64_t>(buffer[offset + 3]) << 24;
- value |= static_cast<uint64_t>(buffer[offset + 4]) << 32;
- value |= static_cast<uint64_t>(buffer[offset + 5]) << 40;
- value |= static_cast<uint64_t>(buffer[offset + 6]) << 48;
- value |= static_cast<uint64_t>(buffer[offset + 7]) << 56;
-
- return value;
+ return arm::pipe::ReadUint64(buffer, offset);
}
uint32_t ReadUint32(const unsigned char* buffer, unsigned int offset)
{
- ARMNN_ASSERT(buffer);
-
- uint32_t value = 0;
- value = static_cast<uint32_t>(buffer[offset]);
- value |= static_cast<uint32_t>(buffer[offset + 1]) << 8;
- value |= static_cast<uint32_t>(buffer[offset + 2]) << 16;
- value |= static_cast<uint32_t>(buffer[offset + 3]) << 24;
- return value;
+ return arm::pipe::ReadUint32(buffer, offset);
}
uint16_t ReadUint16(const unsigned char* buffer, unsigned int offset)
{
- ARMNN_ASSERT(buffer);
-
- uint32_t value = 0;
- value = static_cast<uint32_t>(buffer[offset]);
- value |= static_cast<uint32_t>(buffer[offset + 1]) << 8;
- return static_cast<uint16_t>(value);
+ return arm::pipe::ReadUint16(buffer, offset);
}
uint8_t ReadUint8(const unsigned char* buffer, unsigned int offset)
{
- ARMNN_ASSERT(buffer);
-
- return buffer[offset];
+ return arm::pipe::ReadUint8(buffer, offset);
}
std::string GetSoftwareInfo()
return name;
}
-// Calculate the actual length an SwString will be including the terminating null character
-// padding to bring it to the next uint32_t boundary but minus the leading uint32_t encoding
-// the size to allow the offset to be correctly updated when decoding a binary packet.
-uint32_t CalculateSizeOfPaddedSwString(const std::string& str)
-{
- std::vector<uint32_t> swTraceString;
- StringToSwTraceString<SwTraceCharPolicy>(str, swTraceString);
- unsigned int uint32_t_size = sizeof(uint32_t);
- uint32_t size = (boost::numeric_cast<uint32_t>(swTraceString.size()) - 1) * uint32_t_size;
- return size;
-}
-
-// Read TimelineMessageDirectoryPacket from given IPacketBuffer and offset
-SwTraceMessage ReadSwTraceMessage(const unsigned char* packetBuffer,
- unsigned int& offset,
- const unsigned int& packetLength)
-{
- ARMNN_ASSERT(packetBuffer);
-
- unsigned int uint32_t_size = sizeof(uint32_t);
-
- SwTraceMessage swTraceMessage;
-
- // Read the decl_id
- uint32_t readDeclId = ReadUint32(packetBuffer, offset);
- swTraceMessage.m_Id = readDeclId;
-
- // SWTrace "namestring" format
- // length of the string (first 4 bytes) + string + null terminator
-
- // Check the decl_name
- offset += uint32_t_size;
- uint32_t swTraceDeclNameLength = ReadUint32(packetBuffer, offset);
-
- if (swTraceDeclNameLength == 0 || swTraceDeclNameLength > packetLength)
- {
- throw RuntimeException("Error swTraceDeclNameLength is an invalid size", CHECK_LOCATION());
- }
-
- offset += uint32_t_size;
- std::vector<unsigned char> swTraceStringBuffer(swTraceDeclNameLength - 1);
- std::memcpy(swTraceStringBuffer.data(),
- packetBuffer + offset, swTraceStringBuffer.size());
-
- swTraceMessage.m_Name.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end()); // name
-
- // Check the ui_name
- offset += CalculateSizeOfPaddedSwString(swTraceMessage.m_Name);
- uint32_t swTraceUINameLength = ReadUint32(packetBuffer, offset);
-
- if (swTraceUINameLength == 0 || swTraceUINameLength > packetLength)
- {
- throw RuntimeException("Error swTraceUINameLength is an invalid size", CHECK_LOCATION());
- }
-
- offset += uint32_t_size;
- swTraceStringBuffer.resize(swTraceUINameLength - 1);
- std::memcpy(swTraceStringBuffer.data(),
- packetBuffer + offset, swTraceStringBuffer.size());
-
- swTraceMessage.m_UiName.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end()); // ui_name
-
- // Check arg_types
- offset += CalculateSizeOfPaddedSwString(swTraceMessage.m_UiName);
- uint32_t swTraceArgTypesLength = ReadUint32(packetBuffer, offset);
-
- if (swTraceArgTypesLength == 0 || swTraceArgTypesLength > packetLength)
- {
- throw RuntimeException("Error swTraceArgTypesLength is an invalid size", CHECK_LOCATION());
- }
-
- offset += uint32_t_size;
- swTraceStringBuffer.resize(swTraceArgTypesLength - 1);
- std::memcpy(swTraceStringBuffer.data(),
- packetBuffer + offset, swTraceStringBuffer.size());
-
- swTraceMessage.m_ArgTypes.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end()); // arg_types
-
- std::string swTraceString(swTraceStringBuffer.begin(), swTraceStringBuffer.end());
-
- // Check arg_names
- offset += CalculateSizeOfPaddedSwString(swTraceString);
- uint32_t swTraceArgNamesLength = ReadUint32(packetBuffer, offset);
-
- if (swTraceArgNamesLength == 0 || swTraceArgNamesLength > packetLength)
- {
- throw RuntimeException("Error swTraceArgNamesLength is an invalid size", CHECK_LOCATION());
- }
-
- offset += uint32_t_size;
- swTraceStringBuffer.resize(swTraceArgNamesLength - 1);
- std::memcpy(swTraceStringBuffer.data(),
- packetBuffer + offset, swTraceStringBuffer.size());
-
- swTraceString.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end());
- std::stringstream stringStream(swTraceString);
- std::string argName;
- while (std::getline(stringStream, argName, ','))
- {
- swTraceMessage.m_ArgNames.push_back(argName);
- }
-
- offset += CalculateSizeOfPaddedSwString(swTraceString);
-
- return swTraceMessage;
-}
-
/// Creates a timeline packet header
///
/// \params
// Convert the label into a SWTrace string
std::vector<uint32_t> swTraceLabel;
- bool result = StringToSwTraceString<SwTraceCharPolicy>(label, swTraceLabel);
+ bool result = arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceLabel);
if (!result)
{
return TimelinePacketStatus::Error;
swTraceBuffer.push_back(declId);
bool result = true;
- result &= ConvertDirectoryComponent<SwTraceNameCharPolicy>(directoryComponent[1], swTraceBuffer); // decl_name
- result &= ConvertDirectoryComponent<SwTraceCharPolicy> (directoryComponent[2], swTraceBuffer); // ui_name
- result &= ConvertDirectoryComponent<SwTraceTypeCharPolicy>(directoryComponent[3], swTraceBuffer); // arg_types
- result &= ConvertDirectoryComponent<SwTraceCharPolicy> (directoryComponent[4], swTraceBuffer); // arg_names
+ result &= arm::pipe::ConvertDirectoryComponent<arm::pipe::SwTraceNameCharPolicy>(
+ directoryComponent[1], swTraceBuffer); // decl_name
+ result &= arm::pipe::ConvertDirectoryComponent<arm::pipe::SwTraceCharPolicy> (
+ directoryComponent[2], swTraceBuffer); // ui_name
+ result &= arm::pipe::ConvertDirectoryComponent<arm::pipe::SwTraceTypeCharPolicy>(
+ directoryComponent[3], swTraceBuffer); // arg_types
+ result &= arm::pipe::ConvertDirectoryComponent<arm::pipe::SwTraceCharPolicy> (
+ directoryComponent[4], swTraceBuffer); // arg_names
if (!result)
{
return TimelinePacketStatus::Error;
std::string CentreAlignFormatting(const std::string& stringToPass, const int spacingWidth)
{
- std::stringstream outputStream, centrePadding;
- int padding = spacingWidth - static_cast<int>(stringToPass.size());
-
- for (int i = 0; i < padding / 2; ++i)
- {
- centrePadding << " ";
- }
-
- outputStream << centrePadding.str() << stringToPass << centrePadding.str();
-
- if (padding > 0 && padding %2 != 0)
- {
- outputStream << " ";
- }
-
- return outputStream.str();
+ return arm::pipe::CentreAlignFormatting(stringToPass, spacingWidth);
}
void PrintDeviceDetails(const std::pair<const unsigned short, std::unique_ptr<Device>>& devicePair)
return static_cast<uint64_t>(timestamp.count());
}
-Packet ReceivePacket(const unsigned char* buffer, uint32_t length)
+arm::pipe::Packet ReceivePacket(const unsigned char* buffer, uint32_t length)
{
if (buffer == nullptr)
{
- throw armnnProfiling::ProfilingException("data buffer is nullptr");
+ throw arm::pipe::ProfilingException("data buffer is nullptr");
}
if (length < 8)
{
- throw armnnProfiling::ProfilingException("length of data buffer is less than 8");
+ throw arm::pipe::ProfilingException("length of data buffer is less than 8");
}
uint32_t metadataIdentifier = 0;
std::memcpy(packetData.get(), buffer + 8u, dataLength);
}
- return Packet(metadataIdentifier, dataLength, packetData);
+ return arm::pipe::Packet(metadataIdentifier, dataLength, packetData);
}
} // namespace profiling
#include "ICounterDirectory.hpp"
#include "IPacketBuffer.hpp"
-#include <Packet.hpp>
+#include <common/include/Packet.hpp>
#include <boost/numeric/conversion/cast.hpp>
constexpr unsigned int ThreadIdSize = sizeof(int); // Is platform dependent
-struct SwTraceHeader
-{
- uint8_t m_StreamVersion;
- uint8_t m_PointerBytes;
- uint8_t m_ThreadIdBytes;
-};
-
-struct SwTraceMessage
-{
- uint32_t m_Id;
- std::string m_Name;
- std::string m_UiName;
- std::vector<char> m_ArgTypes;
- std::vector<std::string> m_ArgNames;
-};
-
-struct SwTraceCharPolicy
-{
- static bool IsValidChar(unsigned char c)
- {
- // Check that the given character has ASCII 7-bit encoding
- return c < 128;
- }
-};
-
-struct SwTraceNameCharPolicy
-{
- static bool IsValidChar(unsigned char c)
- {
- // Check that the given character has ASCII 7-bit encoding, alpha-numeric and underscore only
- return c < 128 && (std::isalnum(c) || c == '_');
- }
-};
-
-struct SwTraceTypeCharPolicy
-{
- static bool IsValidChar(unsigned char c)
- {
- // Check that the given character is among the allowed ones
- switch (c)
- {
- case '@':
- case 't':
- case 'i':
- case 'I':
- case 'l':
- case 'L':
- case 'F':
- case 'p':
- case 's':
- return true; // Valid char
- default:
- return false; // Invalid char
- }
- }
-};
-
-template <typename SwTracePolicy>
-bool IsValidSwTraceString(const std::string& s)
-{
- // Check that all the characters in the given string conform to the given policy
- return std::all_of(s.begin(), s.end(), [](unsigned char c) { return SwTracePolicy::IsValidChar(c); });
-}
-
-template <typename SwTracePolicy>
-bool StringToSwTraceString(const std::string& s, std::vector<uint32_t>& outputBuffer)
-{
- // Converts the given string to an SWTrace "string" (i.e. a string of "chars"), and writes it into
- // the given buffer including the null-terminator. It also pads it to the next uint32_t if necessary
-
- // Clear the output buffer
- outputBuffer.clear();
-
- // Check that the given string is a valid SWTrace "string" (i.e. a string of "chars")
- if (!IsValidSwTraceString<SwTracePolicy>(s))
- {
- return false;
- }
-
- // Prepare the output buffer
- size_t s_size = s.size() + 1; // The size of the string (in chars) plus the null-terminator
- size_t uint32_t_size = sizeof(uint32_t);
- // Output buffer size = StringLength (32 bit) + amount of complete 32bit words that fit into the string
- // + an additional 32bit word if there are remaining chars to complete the string
- // (The rest of the 32bit word is then filled with the NULL terminator)
- size_t outBufferSize = 1 + (s_size / uint32_t_size) + (s_size % uint32_t_size != 0 ? 1 : 0);
- outputBuffer.resize(outBufferSize, '\0');
-
- // Write the SWTrace string to the output buffer
- outputBuffer[0] = boost::numeric_cast<uint32_t>(s_size);
- std::memcpy(outputBuffer.data() + 1, s.data(), s_size);
-
- return true;
-}
-
-template <typename SwTracePolicy,
- typename SwTraceBuffer = std::vector<uint32_t>>
-bool ConvertDirectoryComponent(const std::string& directoryComponent, SwTraceBuffer& swTraceBuffer)
-{
- // Convert the directory component using the given policy
- SwTraceBuffer tempSwTraceBuffer;
- bool result = StringToSwTraceString<SwTracePolicy>(directoryComponent, tempSwTraceBuffer);
- if (!result)
- {
- return false;
- }
-
- swTraceBuffer.insert(swTraceBuffer.end(), tempSwTraceBuffer.begin(), tempSwTraceBuffer.end());
-
- return true;
-}
-
uint16_t GetNextUid(bool peekOnly = false);
std::vector<uint16_t> GetNextCounterUids(uint16_t firstUid, uint16_t cores);
BufferExhaustion
};
-uint32_t CalculateSizeOfPaddedSwString(const std::string& str);
-
-SwTraceMessage ReadSwTraceMessage(const unsigned char*, unsigned int&, const unsigned int& packetLength);
-
TimelinePacketStatus WriteTimelineLabelBinaryPacket(uint64_t profilingGuid,
const std::string& label,
unsigned char* buffer,
uint64_t GetTimestamp();
-Packet ReceivePacket(const unsigned char* buffer, uint32_t length);
+arm::pipe::Packet ReceivePacket(const unsigned char* buffer, uint32_t length);
} // namespace profiling
namespace profiling
{
-void RequestCounterDirectoryCommandHandler::operator()(const Packet& packet)
+void RequestCounterDirectoryCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
switch (currentState)
#pragma once
-#include "CommandHandlerFunctor.hpp"
#include "ISendCounterPacket.hpp"
#include "armnn/profiling/ISendTimelinePacket.hpp"
-#include <Packet.hpp>
#include "ProfilingStateMachine.hpp"
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
+
namespace armnn
{
namespace profiling
{
-class RequestCounterDirectoryCommandHandler : public CommandHandlerFunctor
+class RequestCounterDirectoryCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
, m_StateMachine(profilingStateMachine)
{}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
const ICounterDirectory& m_CounterDirectory;
//
#include "SendCounterPacket.hpp"
-#include "EncodeVersion.hpp"
+#include <common/include/EncodeVersion.hpp>
#include <armnn/Exceptions.hpp>
#include <armnn/Conversion.hpp>
#include <Processes.hpp>
#include <armnn/utility/Assert.hpp>
#include <common/include/Constants.hpp>
+#include <common/include/SwTrace.hpp>
#include <boost/format.hpp>
#include <boost/numeric/conversion/cast.hpp>
// Timeline Message Directory (packet_family = 1, packet_class = 0, packet_type = 0) Version 1.0.0
// Timeline Message (packet_family = 1, packet_class = 0, packet_type = 1) Version 1.0.0
std::vector<std::pair<uint32_t, uint32_t>> packetVersions;
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 1), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 2), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 3), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 4), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 5), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 6), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 7), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 1), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 1), EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 2), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 3), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 4), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 5), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 6), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 7), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 1), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
uint32_t numberOfVersions = numeric_cast<uint32_t>(packetVersions.size());
uint32_t packetVersionSize = numeric_cast<uint32_t>(numberOfVersions * 2 * sizeUint32);
// Packet body
offset += sizeUint32;
- WriteUint32(writeBuffer, offset, armnnProfiling::PIPE_MAGIC); // pipe_magic
+ WriteUint32(writeBuffer, offset, arm::pipe::PIPE_MAGIC); // pipe_magic
offset += sizeUint32;
- WriteUint32(writeBuffer, offset, EncodeVersion(1, 0, 0)); // stream_metadata_version
+ WriteUint32(writeBuffer, offset, arm::pipe::EncodeVersion(1, 0, 0)); // stream_metadata_version
offset += sizeUint32;
WriteUint32(writeBuffer, offset, MAX_METADATA_PACKET_LENGTH); // max_data_length
offset += sizeUint32;
// Convert the device name into a SWTrace namestring
std::vector<uint32_t> categoryNameBuffer;
- if (!StringToSwTraceString<SwTraceNameCharPolicy>(categoryName, categoryNameBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(categoryName, categoryNameBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the name of category (%1%) to an SWTrace namestring")
% categoryName);
// Convert the device name into a SWTrace string
std::vector<uint32_t> deviceNameBuffer;
- if (!StringToSwTraceString<SwTraceCharPolicy>(deviceName, deviceNameBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(deviceName, deviceNameBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the name of device %1% (%2%) to an SWTrace string")
% deviceUid
// Convert the device name into a SWTrace namestring
std::vector<uint32_t> counterSetNameBuffer;
- if (!StringToSwTraceString<SwTraceNameCharPolicy>(counterSet->m_Name, counterSetNameBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(counterSet->m_Name, counterSetNameBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the name of counter set %1% (%2%) to "
"an SWTrace namestring")
// Convert the counter name into a SWTrace string
std::vector<uint32_t> counterNameBuffer;
- if (!StringToSwTraceString<SwTraceCharPolicy>(counterName, counterNameBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(counterName, counterNameBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the name of counter %1% (name: %2%) "
"to an SWTrace string")
// Convert the counter description into a SWTrace string
std::vector<uint32_t> counterDescriptionBuffer;
- if (!StringToSwTraceString<SwTraceCharPolicy>(counterDescription, counterDescriptionBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(counterDescription, counterDescriptionBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the description of counter %1% (description: %2%) "
"to an SWTrace string")
if (includeUnits)
{
// Convert the counter units into a SWTrace namestring
- if (!StringToSwTraceString<SwTraceNameCharPolicy>(counterUnits, counterUnitsBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(counterUnits, counterUnitsBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the units of counter %1% (units: %2%) "
"to an SWTrace string")
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "SendThread.hpp"
-#include "EncodeVersion.hpp"
#include "ProfilingUtils.hpp"
#include <armnn/Exceptions.hpp>
using boost::numeric_cast;
SendThread::SendThread(armnn::profiling::ProfilingStateMachine& profilingStateMachine,
- armnn::profiling::IBufferManager& buffer, armnn::profiling::ISendCounterPacket& sendCounterPacket, int timeout)
+ armnn::profiling::IBufferManager& buffer,
+ armnn::profiling::ISendCounterPacket& sendCounterPacket,
+ int timeout)
: m_StateMachine(profilingStateMachine)
, m_BufferManager(buffer)
, m_SendCounterPacket(sendCounterPacket)
#include <fcntl.h>
#include <string>
-using namespace armnnUtils;
namespace armnn
{
SocketProfilingConnection::SocketProfilingConnection()
{
- Sockets::Initialize();
+ arm::pipe::Initialize();
memset(m_Socket, 0, sizeof(m_Socket));
// Note: we're using Linux specific SOCK_CLOEXEC flag.
m_Socket[0].fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (m_Socket[0].fd == -1)
{
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Socket construction failed: ") + strerror(errno),
m_Socket[0].fd,
errno);
if (0 != connect(m_Socket[0].fd, reinterpret_cast<const sockaddr*>(&server), sizeof(sockaddr_un)))
{
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Cannot connect to stream socket: ") + strerror(errno),
m_Socket[0].fd,
errno);
m_Socket[0].events = POLLIN;
// Make the socket non blocking.
- if (!Sockets::SetNonBlocking(m_Socket[0].fd))
+ if (!arm::pipe::SetNonBlocking(m_Socket[0].fd))
{
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Failed to set socket as non blocking: ") + strerror(errno),
m_Socket[0].fd,
errno);
void SocketProfilingConnection::Close()
{
- if (Sockets::Close(m_Socket[0].fd) != 0)
+ if (arm::pipe::Close(m_Socket[0].fd) != 0)
{
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Cannot close stream socket: ") + strerror(errno),
m_Socket[0].fd,
errno);
return false;
}
- return Sockets::Write(m_Socket[0].fd, buffer, length) != -1;
+ return arm::pipe::Write(m_Socket[0].fd, buffer, length) != -1;
}
-Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
+arm::pipe::Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
{
// Is there currently at least a header worth of data waiting to be read?
int bytes_available = 0;
- Sockets::Ioctl(m_Socket[0].fd, FIONREAD, &bytes_available);
+ arm::pipe::Ioctl(m_Socket[0].fd, FIONREAD, &bytes_available);
if (bytes_available >= 8)
{
// Yes there is. Read it:
}
// Poll for data on the socket or until timeout occurs
- int pollResult = Sockets::Poll(&m_Socket[0], 1, static_cast<int>(timeout));
+ int pollResult = arm::pipe::Poll(&m_Socket[0], 1, static_cast<int>(timeout));
switch (pollResult)
{
case -1: // Error
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Error occured while reading from socket: ") + strerror(errno),
m_Socket[0].fd,
errno);
case 0: // Timeout
- throw TimeoutException("SocketProfilingConnection: Timeout while reading from socket");
+ throw arm::pipe::TimeoutException("SocketProfilingConnection: Timeout while reading from socket");
default: // Normal poll return but it could still contain an error signal
// Check if the socket reported an error
{
// This is an unrecoverable error.
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Error occured while polling receiving socket: POLLNVAL."),
m_Socket[0].fd);
}
if (m_Socket[0].revents == POLLERR)
{
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string(
"SocketProfilingConnection: Error occured while polling receiving socket: POLLERR: ")
+ strerror(errno),
{
// This is an unrecoverable error.
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Connection closed by remote client: POLLHUP."),
m_Socket[0].fd);
}
}
}
-Packet SocketProfilingConnection::ReceivePacket()
+arm::pipe::Packet SocketProfilingConnection::ReceivePacket()
{
char header[8] = {};
- long receiveResult = Sockets::Read(m_Socket[0].fd, &header, sizeof(header));
+ long receiveResult = arm::pipe::Read(m_Socket[0].fd, &header, sizeof(header));
// We expect 8 as the result here. 0 means EOF, socket is closed. -1 means there been some other kind of error.
switch( receiveResult )
{
case 0:
// Socket has closed.
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Remote socket has closed the connection."),
m_Socket[0].fd);
case -1:
// There's been a socket error. We will presume it's unrecoverable.
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Error occured while reading the packet: ") + strerror(errno),
m_Socket[0].fd,
errno);
default:
if (receiveResult < 8)
{
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string(
"SocketProfilingConnection: The received packet did not contains a valid PIPE header."),
m_Socket[0].fd);
if (dataLength > 0)
{
packetData = std::make_unique<unsigned char[]>(dataLength);
- long receivedLength = Sockets::Read(m_Socket[0].fd, packetData.get(), dataLength);
+ long receivedLength = arm::pipe::Read(m_Socket[0].fd, packetData.get(), dataLength);
if (receivedLength < 0)
{
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Error occured while reading the packet: ") + strerror(errno),
m_Socket[0].fd,
errno);
if (dataLength != static_cast<uint32_t>(receivedLength))
{
// What do we do here if we can't read in a full packet?
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Invalid PIPE packet."),
m_Socket[0].fd);
}
}
- return Packet(metadataIdentifier, dataLength, packetData);
+ return arm::pipe::Packet(metadataIdentifier, dataLength, packetData);
}
} // namespace profiling
bool IsOpen() const final;
void Close() final;
bool WritePacket(const unsigned char* buffer, uint32_t length) final;
- Packet ReadPacket(uint32_t timeout) final;
+ arm::pipe::Packet ReadPacket(uint32_t timeout) final;
private:
// Read a full packet from the socket.
- Packet ReceivePacket();
+ arm::pipe::Packet ReceivePacket();
#ifndef __APPLE__
// To indicate we want to use an abstract UDS ensure the first character of the address is 0.
// MACOSX does not support abstract UDS
const char* m_GatorNamespace = "/tmp/gatord_namespace";
#endif
- armnnUtils::Sockets::PollFd m_Socket[1]{};
+ arm::pipe::PollFd m_Socket[1]{};
};
} // namespace profiling
#include "PacketBuffer.hpp"
#include "ProfilingUtils.hpp"
+#include <common/include/SwTrace.hpp>
+
#include <armnn/Exceptions.hpp>
#include <boost/test/unit_test.hpp>
unsigned int uint32_t_size = sizeof(uint32_t);
unsigned int offset = uint32_t_size;
- BOOST_CHECK_THROW(ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()),
- armnn::RuntimeException);
+ BOOST_CHECK_THROW(arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()),
+ arm::pipe::ProfilingException);
}
unsigned int uint32_t_size = sizeof(uint32_t);
unsigned int offset = uint32_t_size;
- BOOST_CHECK_THROW(ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()),
- armnn::RuntimeException);
+ BOOST_CHECK_THROW(arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()),
+ arm::pipe::ProfilingException);
}
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "PrintPacketHeaderHandler.hpp"
#include <iostream>
+#include <sstream>
namespace armnn
{
return std::vector<uint32_t>();
}
-void PrintPacketHeaderHandler::HandlePacket(const Packet& packet)
+void PrintPacketHeaderHandler::HandlePacket(const arm::pipe::Packet& packet)
{
std::stringstream ss;
ss << "Handler Received Outgoing Packet [" << packet.GetPacketFamily() << ":" << packet.GetPacketId() << "]";
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include <armnn/profiling/ILocalPacketHandler.hpp>
-#include <Packet.hpp>
+
+#include <common/include/Packet.hpp>
namespace armnn
{
{
virtual std::vector<uint32_t> GetHeadersAccepted();
- virtual void HandlePacket(const Packet& packet);
+ virtual void HandlePacket(const arm::pipe::Packet& packet);
};
} // namespace profiling
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
{
// populate packet data and construct packet
std::memcpy(m_PacketData.get(), g_DataPtr, g_DataLength);
- m_Packet = std::make_unique<Packet>(0u, g_DataLength, m_PacketData);
+ m_Packet = std::make_unique<arm::pipe::Packet>(0u, g_DataLength, m_PacketData);
}
~DummyProfilingConnection() = default;
return true;
}
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
armnn::IgnoreUnused(timeout);
return std::move(*m_Packet);
private:
bool m_Open;
std::unique_ptr<unsigned char[]> m_PacketData;
- std::unique_ptr<Packet> m_Packet;
+ std::unique_ptr<arm::pipe::Packet> m_Packet;
};
std::vector<char> ReadDumpFile(const std::string& dumpFileName)
ProfilingConnectionDumpToFileDecorator decorator(std::make_unique<DummyProfilingConnection>(), options, false);
// NOTE: unique_ptr is needed here because operator=() is deleted for Packet
- std::unique_ptr<Packet> packet;
- BOOST_CHECK_NO_THROW(packet = std::make_unique<Packet>(decorator.ReadPacket(0)));
+ std::unique_ptr<arm::pipe::Packet> packet;
+ BOOST_CHECK_NO_THROW(packet = std::make_unique<arm::pipe::Packet>(decorator.ReadPacket(0)));
decorator.Close();
}
}
- bool WritePacket(Packet&& packet)
+ bool WritePacket(arm::pipe::Packet&& packet)
{
std::lock_guard<std::mutex> lock(m_Mutex);
return true;
}
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
IgnoreUnused(timeout);
private:
bool m_IsOpen;
std::vector<std::pair<PacketType, uint32_t>> m_WrittenData;
- Packet m_Packet;
+ arm::pipe::Packet m_Packet;
mutable std::mutex m_Mutex;
};
#include "ProfilingTestUtils.hpp"
#include <backends/BackendProfiling.hpp>
+#include <common/include/EncodeVersion.hpp>
+#include <common/include/PacketVersionResolver.hpp>
+#include <common/include/SwTrace.hpp>
#include <CommandHandler.hpp>
-#include <CommandHandlerKey.hpp>
-#include <CommandHandlerRegistry.hpp>
-#include <common/include/SocketConnectionException.hpp>
#include <ConnectionAcknowledgedCommandHandler.hpp>
#include <CounterDirectory.hpp>
#include <CounterIdMap.hpp>
-#include <EncodeVersion.hpp>
#include <Holder.hpp>
#include <ICounterValues.hpp>
-#include <Packet.hpp>
-#include <PacketVersionResolver.hpp>
#include <PeriodicCounterCapture.hpp>
#include <PeriodicCounterSelectionCommandHandler.hpp>
#include <ProfilingStateMachine.hpp>
#include <armnn/Utils.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
+#include <common/include/CommandHandlerKey.hpp>
+#include <common/include/CommandHandlerRegistry.hpp>
+#include <common/include/SocketConnectionException.hpp>
+#include <common/include/Packet.hpp>
+
#include <boost/numeric/conversion/cast.hpp>
#include <cstdint>
BOOST_AUTO_TEST_CASE(CheckCommandHandlerKeyComparisons)
{
- CommandHandlerKey testKey1_0(1, 1, 1);
- CommandHandlerKey testKey1_1(1, 1, 1);
- CommandHandlerKey testKey1_2(1, 2, 1);
+ arm::pipe::CommandHandlerKey testKey1_0(1, 1, 1);
+ arm::pipe::CommandHandlerKey testKey1_1(1, 1, 1);
+ arm::pipe::CommandHandlerKey testKey1_2(1, 2, 1);
- CommandHandlerKey testKey0(0, 1, 1);
- CommandHandlerKey testKey1(0, 1, 1);
- CommandHandlerKey testKey2(0, 1, 1);
- CommandHandlerKey testKey3(0, 0, 0);
- CommandHandlerKey testKey4(0, 2, 2);
- CommandHandlerKey testKey5(0, 0, 2);
+ arm::pipe::CommandHandlerKey testKey0(0, 1, 1);
+ arm::pipe::CommandHandlerKey testKey1(0, 1, 1);
+ arm::pipe::CommandHandlerKey testKey2(0, 1, 1);
+ arm::pipe::CommandHandlerKey testKey3(0, 0, 0);
+ arm::pipe::CommandHandlerKey testKey4(0, 2, 2);
+ arm::pipe::CommandHandlerKey testKey5(0, 0, 2);
BOOST_CHECK(testKey1_0 > testKey0);
BOOST_CHECK(testKey1_0 == testKey1_1);
BOOST_CHECK(testKey1.GetPacketId() == 1);
BOOST_CHECK(testKey1.GetVersion() == 1);
- std::vector<CommandHandlerKey> vect = { CommandHandlerKey(0, 0, 1), CommandHandlerKey(0, 2, 0),
- CommandHandlerKey(0, 1, 0), CommandHandlerKey(0, 2, 1),
- CommandHandlerKey(0, 1, 1), CommandHandlerKey(0, 0, 1),
- CommandHandlerKey(0, 2, 0), CommandHandlerKey(0, 0, 0) };
+ std::vector<arm::pipe::CommandHandlerKey> vect = {
+ arm::pipe::CommandHandlerKey(0, 0, 1), arm::pipe::CommandHandlerKey(0, 2, 0),
+ arm::pipe::CommandHandlerKey(0, 1, 0), arm::pipe::CommandHandlerKey(0, 2, 1),
+ arm::pipe::CommandHandlerKey(0, 1, 1), arm::pipe::CommandHandlerKey(0, 0, 1),
+ arm::pipe::CommandHandlerKey(0, 2, 0), arm::pipe::CommandHandlerKey(0, 0, 0) };
std::sort(vect.begin(), vect.end());
- std::vector<CommandHandlerKey> expectedVect = { CommandHandlerKey(0, 0, 0), CommandHandlerKey(0, 0, 1),
- CommandHandlerKey(0, 0, 1), CommandHandlerKey(0, 1, 0),
- CommandHandlerKey(0, 1, 1), CommandHandlerKey(0, 2, 0),
- CommandHandlerKey(0, 2, 0), CommandHandlerKey(0, 2, 1) };
+ std::vector<arm::pipe::CommandHandlerKey> expectedVect = {
+ arm::pipe::CommandHandlerKey(0, 0, 0), arm::pipe::CommandHandlerKey(0, 0, 1),
+ arm::pipe::CommandHandlerKey(0, 0, 1), arm::pipe::CommandHandlerKey(0, 1, 0),
+ arm::pipe::CommandHandlerKey(0, 1, 1), arm::pipe::CommandHandlerKey(0, 2, 0),
+ arm::pipe::CommandHandlerKey(0, 2, 0), arm::pipe::CommandHandlerKey(0, 2, 1) };
BOOST_CHECK(vect == expectedVect);
}
BOOST_AUTO_TEST_CASE(CheckPacketKeyComparisons)
{
- PacketKey key0(0, 0);
- PacketKey key1(0, 0);
- PacketKey key2(0, 1);
- PacketKey key3(0, 2);
- PacketKey key4(1, 0);
- PacketKey key5(1, 0);
- PacketKey key6(1, 1);
+ arm::pipe::PacketKey key0(0, 0);
+ arm::pipe::PacketKey key1(0, 0);
+ arm::pipe::PacketKey key2(0, 1);
+ arm::pipe::PacketKey key3(0, 2);
+ arm::pipe::PacketKey key4(1, 0);
+ arm::pipe::PacketKey key5(1, 0);
+ arm::pipe::PacketKey key6(1, 1);
BOOST_CHECK(!(key0 < key1));
BOOST_CHECK(!(key0 > key1));
BOOST_AUTO_TEST_CASE(CheckCommandHandler)
{
- PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
ProfilingStateMachine profilingStateMachine;
TestProfilingConnectionBase testProfilingConnectionBase;
sendCounterPacket, sendTimelinePacket,
profilingStateMachine,
mockProfilingServiceStatus);
- CommandHandlerRegistry commandHandlerRegistry;
+ arm::pipe::CommandHandlerRegistry commandHandlerRegistry;
commandHandlerRegistry.RegisterFunctor(&connectionAcknowledgedCommandHandler);
BOOST_AUTO_TEST_CASE(CheckEncodeVersion)
{
- Version version1(12);
+ arm::pipe::Version version1(12);
BOOST_CHECK(version1.GetMajor() == 0);
BOOST_CHECK(version1.GetMinor() == 0);
BOOST_CHECK(version1.GetPatch() == 12);
- Version version2(4108);
+ arm::pipe::Version version2(4108);
BOOST_CHECK(version2.GetMajor() == 0);
BOOST_CHECK(version2.GetMinor() == 1);
BOOST_CHECK(version2.GetPatch() == 12);
- Version version3(4198412);
+ arm::pipe::Version version3(4198412);
BOOST_CHECK(version3.GetMajor() == 1);
BOOST_CHECK(version3.GetMinor() == 1);
BOOST_CHECK(version3.GetPatch() == 12);
- Version version4(0);
+ arm::pipe::Version version4(0);
BOOST_CHECK(version4.GetMajor() == 0);
BOOST_CHECK(version4.GetMinor() == 0);
BOOST_CHECK(version4.GetPatch() == 0);
- Version version5(1, 0, 0);
+ arm::pipe::Version version5(1, 0, 0);
BOOST_CHECK(version5.GetEncodedValue() == 4194304);
}
std::unique_ptr<unsigned char[]> packetData1 = std::make_unique<unsigned char[]>(0);
std::unique_ptr<unsigned char[]> nullPacketData;
- Packet packetTest0(472580096, length, packetData0);
+ arm::pipe::Packet packetTest0(472580096, length, packetData0);
BOOST_CHECK(packetTest0.GetHeader() == 472580096);
BOOST_CHECK(packetTest0.GetPacketFamily() == 7);
BOOST_CHECK(packetTest0.GetPacketType() == 3);
BOOST_CHECK(packetTest0.GetPacketClass() == 5);
- BOOST_CHECK_THROW(Packet packetTest1(472580096, 0, packetData1), armnn::Exception);
- BOOST_CHECK_NO_THROW(Packet packetTest2(472580096, 0, nullPacketData));
+ BOOST_CHECK_THROW(arm::pipe::Packet packetTest1(472580096, 0, packetData1), arm::pipe::InvalidArgumentException);
+ BOOST_CHECK_NO_THROW(arm::pipe::Packet packetTest2(472580096, 0, nullPacketData));
- Packet packetTest3(472580096, 0, nullPacketData);
+ arm::pipe::Packet packetTest3(472580096, 0, nullPacketData);
BOOST_CHECK(packetTest3.GetLength() == 0);
BOOST_CHECK(packetTest3.GetData() == nullptr);
const unsigned char* packetTest0Data = packetTest0.GetData();
- Packet packetTest4(std::move(packetTest0));
+ arm::pipe::Packet packetTest4(std::move(packetTest0));
BOOST_CHECK(packetTest0.GetData() == nullptr);
BOOST_CHECK(packetTest4.GetData() == packetTest0Data);
TestFunctorB testFunctorB(8, 963, version);
TestFunctorC testFunctorC(5, 983, version);
- CommandHandlerKey keyA(testFunctorA.GetFamilyId(), testFunctorA.GetPacketId(), testFunctorA.GetVersion());
- CommandHandlerKey keyB(testFunctorB.GetFamilyId(), testFunctorB.GetPacketId(), testFunctorB.GetVersion());
- CommandHandlerKey keyC(testFunctorC.GetFamilyId(), testFunctorC.GetPacketId(), testFunctorC.GetVersion());
+ arm::pipe::CommandHandlerKey keyA(
+ testFunctorA.GetFamilyId(), testFunctorA.GetPacketId(), testFunctorA.GetVersion());
+ arm::pipe::CommandHandlerKey keyB(
+ testFunctorB.GetFamilyId(), testFunctorB.GetPacketId(), testFunctorB.GetVersion());
+ arm::pipe::CommandHandlerKey keyC(
+ testFunctorC.GetFamilyId(), testFunctorC.GetPacketId(), testFunctorC.GetVersion());
// Create the unwrapped map to simulate the Command Handler Registry
- std::map<CommandHandlerKey, CommandHandlerFunctor*> registry;
+ std::map<arm::pipe::CommandHandlerKey, arm::pipe::CommandHandlerFunctor*> registry;
registry.insert(std::make_pair(keyB, &testFunctorB));
registry.insert(std::make_pair(keyA, &testFunctorA));
std::unique_ptr<unsigned char[]> packetDataB;
std::unique_ptr<unsigned char[]> packetDataC;
- Packet packetA(500000000, 0, packetDataA);
- Packet packetB(600000000, 0, packetDataB);
- Packet packetC(400000000, 0, packetDataC);
+ arm::pipe::Packet packetA(500000000, 0, packetDataA);
+ arm::pipe::Packet packetB(600000000, 0, packetDataB);
+ arm::pipe::Packet packetC(400000000, 0, packetDataC);
// Check the correct operator of derived class is called
- registry.at(CommandHandlerKey(packetA.GetPacketFamily(), packetA.GetPacketId(), version))->operator()(packetA);
+ registry.at(arm::pipe::CommandHandlerKey(
+ packetA.GetPacketFamily(), packetA.GetPacketId(), version))->operator()(packetA);
BOOST_CHECK(testFunctorA.GetCount() == 1);
BOOST_CHECK(testFunctorB.GetCount() == 0);
BOOST_CHECK(testFunctorC.GetCount() == 0);
- registry.at(CommandHandlerKey(packetB.GetPacketFamily(), packetB.GetPacketId(), version))->operator()(packetB);
+ registry.at(arm::pipe::CommandHandlerKey(
+ packetB.GetPacketFamily(), packetB.GetPacketId(), version))->operator()(packetB);
BOOST_CHECK(testFunctorA.GetCount() == 1);
BOOST_CHECK(testFunctorB.GetCount() == 1);
BOOST_CHECK(testFunctorC.GetCount() == 0);
- registry.at(CommandHandlerKey(packetC.GetPacketFamily(), packetC.GetPacketId(), version))->operator()(packetC);
+ registry.at(arm::pipe::CommandHandlerKey(
+ packetC.GetPacketFamily(), packetC.GetPacketId(), version))->operator()(packetC);
BOOST_CHECK(testFunctorA.GetCount() == 1);
BOOST_CHECK(testFunctorB.GetCount() == 1);
BOOST_CHECK(testFunctorC.GetCount() == 1);
TestFunctorC testFunctorC(5, 983, version);
// Create the Command Handler Registry
- CommandHandlerRegistry registry;
+ arm::pipe::CommandHandlerRegistry registry;
// Register multiple different derived classes
registry.RegisterFunctor(&testFunctorA);
std::unique_ptr<unsigned char[]> packetDataB;
std::unique_ptr<unsigned char[]> packetDataC;
- Packet packetA(500000000, 0, packetDataA);
- Packet packetB(600000000, 0, packetDataB);
- Packet packetC(400000000, 0, packetDataC);
+ arm::pipe::Packet packetA(500000000, 0, packetDataA);
+ arm::pipe::Packet packetB(600000000, 0, packetDataB);
+ arm::pipe::Packet packetC(400000000, 0, packetDataC);
// Check the correct operator of derived class is called
registry.GetFunctor(packetA.GetPacketFamily(), packetA.GetPacketId(), version)->operator()(packetA);
BOOST_CHECK(testFunctorC.GetCount() == 2);
// Check that non-existent key returns nullptr for its functor
- BOOST_CHECK_THROW(registry.GetFunctor(0, 0, 0), armnn::Exception);
+ BOOST_CHECK_THROW(registry.GetFunctor(0, 0, 0), arm::pipe::ProfilingException);
}
BOOST_AUTO_TEST_CASE(CheckPacketVersionResolver)
std::numeric_limits<uint32_t>::max());
// NOTE: Expected version is always 1.0.0, regardless of packetId
- const Version expectedVersion(1, 0, 0);
+ const arm::pipe::Version expectedVersion(1, 0, 0);
- PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
constexpr unsigned int numTests = 10u;
{
const uint32_t familyId = distribution(generator);
const uint32_t packetId = distribution(generator);
- Version resolvedVersion = packetVersionResolver.ResolvePacketVersion(familyId, packetId);
+ arm::pipe::Version resolvedVersion = packetVersionResolver.ResolvePacketVersion(familyId, packetId);
BOOST_TEST(resolvedVersion == expectedVersion);
}
// Register a counter with a valid parent category name and not associated with a device
const Counter* counterWoDevice = nullptr;
BOOST_CHECK_NO_THROW(counterWoDevice = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID,
- 26,
- categoryName,
- 0,
- 1,
- 123.45f,
- "valid name 3",
- "valid description",
- armnn::EmptyOptional(),// Units
- armnn::EmptyOptional(),// Number of cores
- 0)); // Device UID
+ 26,
+ categoryName,
+ 0,
+ 1,
+ 123.45f,
+ "valid name 3",
+ "valid description",
+ armnn::EmptyOptional(),// Units
+ armnn::EmptyOptional(),// Number of cores
+ 0)); // Device UID
BOOST_CHECK(counterDirectory.GetCounterCount() == 3);
BOOST_CHECK(counterWoDevice);
BOOST_CHECK(counterWoDevice->m_Uid > counter->m_Uid);
123.45f,
"valid name 5",
std::string("valid description"),
- armnn::EmptyOptional(), // Units
- armnn::EmptyOptional(), // Number of cores
- device->m_Uid)); // Device UID
+ armnn::EmptyOptional(), // Units
+ armnn::EmptyOptional(), // Number of cores
+ device->m_Uid)); // Device UID
BOOST_CHECK(counterDirectory.GetCounterCount() == 4);
BOOST_CHECK(counterWDevice);
BOOST_CHECK(counterWDevice->m_Uid > counter->m_Uid);
armnn::EmptyOptional(),// Units
armnn::EmptyOptional(),// No of cores
armnn::EmptyOptional(),// Device UID
- 0)); // CounterSet UID
+ 0)); // CounterSet UID
BOOST_CHECK(counterDirectory.GetCounterCount() == 5);
BOOST_CHECK(counterWoCounterSet);
BOOST_CHECK(counterWoCounterSet->m_Uid > counter->m_Uid);
const Counter* counterWMultiCoreDeviceWParentCategory = nullptr;
uint16_t numberOfCourse = multiCoreDeviceWParentCategory->m_Cores;
BOOST_CHECK_NO_THROW(counterWMultiCoreDeviceWParentCategory =
- counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID,
- 100,
- categoryName,
- 0,
- 1,
- 123.45f,
- "valid name 10",
- "valid description",
- armnn::EmptyOptional(), // Units
- numberOfCourse, // Number of cores
- armnn::EmptyOptional(), // Device UID
- armnn::EmptyOptional()));// Counter set UID
+ counterDirectory.RegisterCounter(
+ armnn::profiling::BACKEND_ID,
+ 100,
+ categoryName,
+ 0,
+ 1,
+ 123.45f,
+ "valid name 10",
+ "valid description",
+ armnn::EmptyOptional(), // Units
+ numberOfCourse, // Number of cores
+ armnn::EmptyOptional(), // Device UID
+ armnn::EmptyOptional()));// Counter set UID
BOOST_CHECK(counterDirectory.GetCounterCount() == 26);
BOOST_CHECK(counterWMultiCoreDeviceWParentCategory);
BOOST_CHECK(counterWMultiCoreDeviceWParentCategory->m_Uid > counter->m_Uid);
BOOST_CHECK_NO_THROW(anotherCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, 24,
anotherCategoryName, 1, 0, .00043f,
"valid name", "valid description",
- armnn::EmptyOptional(), // Units
- armnn::EmptyOptional(), // Number of cores
- device->m_Uid, // Device UID
- counterSet->m_Uid)); // Counter set UID
+ armnn::EmptyOptional(), // Units
+ armnn::EmptyOptional(), // Number of cores
+ device->m_Uid, // Device UID
+ counterSet->m_Uid)); // Counter set UID
BOOST_CHECK(counterDirectory.GetCounterCount() == 29);
BOOST_CHECK(anotherCounter);
BOOST_CHECK(anotherCounter->m_MaxCounterUid == anotherCounter->m_Uid);
offset += sizeOfUint16;
WriteUint16(data1, offset, 5000);
- Packet packetA(packetId, dataLength1, uniqueData1);
+ arm::pipe::Packet packetA(packetId, dataLength1, uniqueData1);
PeriodicCounterSelectionCommandHandler commandHandler(familyId, packetId, version, backendProfilingContext,
counterIdMap, holder, 10000u, captureThread,
WriteUint32(reinterpret_cast<unsigned char*>(uniqueData2.get()), 0, period2);
- Packet packetB(packetId, dataLength2, uniqueData2);
+ arm::pipe::Packet packetB(packetId, dataLength2, uniqueData2);
commandHandler(packetB);
std::atomic<bool> m_timelineReporting;
};
- PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
BufferManager bufferManager(512);
SendTimelinePacket sendTimelinePacket(bufferManager);
uint32_t packetHeader1 = ConstructHeader(packetFamily1, packetId1);
// Create the ActivateTimelineReportingPacket
- Packet ActivateTimelineReportingPacket(packetHeader1); // Length == 0
+ arm::pipe::Packet ActivateTimelineReportingPacket(packetHeader1); // Length == 0
BOOST_CHECK_THROW(
activateTimelineReportingCommandHandler.operator()(ActivateTimelineReportingPacket), armnn::Exception);
uint32_t packetHeader2 = ConstructHeader(packetFamily2, packetId2);
// Create the DeactivateTimelineReportingPacket
- Packet deactivateTimelineReportingPacket(packetHeader2); // Length == 0
+ arm::pipe::Packet deactivateTimelineReportingPacket(packetHeader2); // Length == 0
stateMachine.Reset();
BOOST_CHECK_THROW(
offset += sizeOfUint16;
WriteUint16(data1, offset, 5000);
- Packet packetA(connectionPacketId, dataLength1, uniqueData1);
+ arm::pipe::Packet packetA(connectionPacketId, dataLength1, uniqueData1);
ProfilingStateMachine profilingState(ProfilingState::Uninitialised);
BOOST_CHECK(profilingState.GetCurrentState() == ProfilingState::Uninitialised);
// command handler received different packet
const uint32_t differentPacketId = 0x40000;
- Packet packetB(differentPacketId, dataLength1, uniqueData1);
+ arm::pipe::Packet packetB(differentPacketId, dataLength1, uniqueData1);
profilingState.TransitionToState(ProfilingState::NotConnected);
profilingState.TransitionToState(ProfilingState::WaitingForAck);
ConnectionAcknowledgedCommandHandler differentCommandHandler(packetFamilyId,
BOOST_AUTO_TEST_CASE(CheckSocketConnectionException)
{
// Check that creating a SocketProfilingConnection armnnProfiling in an exception as the Gator UDS doesn't exist.
- BOOST_CHECK_THROW(new SocketProfilingConnection(), armnnProfiling::SocketConnectionException);
+ BOOST_CHECK_THROW(new SocketProfilingConnection(), arm::pipe::SocketConnectionException);
}
BOOST_AUTO_TEST_CASE(CheckSocketConnectionException2)
{
new SocketProfilingConnection();
}
- catch (const armnnProfiling::SocketConnectionException& ex)
+ catch (const arm::pipe::SocketConnectionException& ex)
{
BOOST_CHECK(ex.GetSocketFd() == 0);
BOOST_CHECK(ex.GetErrorNo() == 111);
// Only ASCII 7-bit encoding supported
for (unsigned char c = 0; c < 128; c++)
{
- BOOST_CHECK(SwTraceCharPolicy::IsValidChar(c));
+ BOOST_CHECK(arm::pipe::SwTraceCharPolicy::IsValidChar(c));
}
// Not ASCII
for (unsigned char c = 255; c >= 128; c++)
{
- BOOST_CHECK(!SwTraceCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceCharPolicy::IsValidChar(c));
}
}
const unsigned char validChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
for (unsigned char i = 0; i < sizeof(validChars) / sizeof(validChars[0]) - 1; i++)
{
- BOOST_CHECK(SwTraceNameCharPolicy::IsValidChar(validChars[i]));
+ BOOST_CHECK(arm::pipe::SwTraceNameCharPolicy::IsValidChar(validChars[i]));
}
// Non alpha-numeric chars
for (unsigned char c = 0; c < 48; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
for (unsigned char c = 58; c < 65; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
for (unsigned char c = 91; c < 95; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
for (unsigned char c = 96; c < 97; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
for (unsigned char c = 123; c < 128; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
// Not ASCII
for (unsigned char c = 255; c >= 128; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
}
BOOST_AUTO_TEST_CASE(IsValidSwTraceStringTest)
{
// Valid SWTrace strings
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>(""));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("_"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("0123"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("valid_string"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("VALID_string_456"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>(" "));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("valid string"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("!$%"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("valid|\\~string#123"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>(""));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("_"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("0123"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("valid_string"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("VALID_string_456"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>(" "));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("valid string"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("!$%"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("valid|\\~string#123"));
// Invalid SWTrace strings
- BOOST_CHECK(!IsValidSwTraceString<SwTraceCharPolicy>("€£"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceCharPolicy>("invalid‡string"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceCharPolicy>("12Ž34"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("€£"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("invalid‡string"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("12Ž34"));
}
BOOST_AUTO_TEST_CASE(IsValidSwTraceNameStringTest)
{
// Valid SWTrace name strings
- BOOST_CHECK(IsValidSwTraceString<SwTraceNameCharPolicy>(""));
- BOOST_CHECK(IsValidSwTraceString<SwTraceNameCharPolicy>("_"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceNameCharPolicy>("0123"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceNameCharPolicy>("valid_string"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceNameCharPolicy>("VALID_string_456"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(""));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("_"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("0123"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("valid_string"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("VALID_string_456"));
// Invalid SWTrace name strings
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>(" "));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("invalid string"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("!$%"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("invalid|\\~string#123"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("€£"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("invalid‡string"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("12Ž34"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(" "));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid string"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("!$%"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid|\\~string#123"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("€£"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid‡string"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("12Ž34"));
}
template <typename SwTracePolicy>
void StringToSwTraceStringTestHelper(const std::string& testString, std::vector<uint32_t> buffer, size_t expectedSize)
{
// Convert the test string to a SWTrace string
- BOOST_CHECK(StringToSwTraceString<SwTracePolicy>(testString, buffer));
+ BOOST_CHECK(arm::pipe::StringToSwTraceString<SwTracePolicy>(testString, buffer));
// The buffer must contain at least the length of the string
BOOST_CHECK(!buffer.empty());
std::vector<uint32_t> buffer;
// Valid SWTrace strings (expected size in words)
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("_", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("0123", buffer, 3);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("valid_string", buffer, 5);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("VALID_string_456", buffer, 6);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>(" ", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("valid string", buffer, 5);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("!$%", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("valid|\\~string#123", buffer, 6);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("_", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("0123", buffer, 3);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("valid_string", buffer, 5);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("VALID_string_456", buffer, 6);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>(" ", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("valid string", buffer, 5);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("!$%", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("valid|\\~string#123", buffer, 6);
// Invalid SWTrace strings
- BOOST_CHECK(!StringToSwTraceString<SwTraceCharPolicy>("€£", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>("€£", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceCharPolicy>("invalid‡string", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>("invalid‡string", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceCharPolicy>("12Ž34", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>("12Ž34", buffer));
BOOST_CHECK(buffer.empty());
}
std::vector<uint32_t> buffer;
// Valid SWTrace namestrings (expected size in words)
- StringToSwTraceStringTestHelper<SwTraceNameCharPolicy>("", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceNameCharPolicy>("_", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceNameCharPolicy>("0123", buffer, 3);
- StringToSwTraceStringTestHelper<SwTraceNameCharPolicy>("valid_string", buffer, 5);
- StringToSwTraceStringTestHelper<SwTraceNameCharPolicy>("VALID_string_456", buffer, 6);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceNameCharPolicy>("", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceNameCharPolicy>("_", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceNameCharPolicy>("0123", buffer, 3);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceNameCharPolicy>("valid_string", buffer, 5);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceNameCharPolicy>("VALID_string_456", buffer, 6);
// Invalid SWTrace namestrings
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>(" ", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(" ", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("invalid string", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid string", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("!$%", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("!$%", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("invalid|\\~string#123", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid|\\~string#123", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("€£", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("€£", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("invalid‡string", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid‡string", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("12Ž34", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("12Ž34", buffer));
BOOST_CHECK(buffer.empty());
}
const uint32_t wrongPacketId = 47;
const uint32_t wrongHeader = (wrongPacketId & 0x000003FF) << 16;
- Packet wrongPacket(wrongHeader);
+ arm::pipe::Packet wrongPacket(wrongHeader);
profilingStateMachine.TransitionToState(ProfilingState::Uninitialised);
BOOST_CHECK_THROW(commandHandler(wrongPacket), armnn::RuntimeException); // Wrong profiling state
const uint32_t rightHeader = (packetId & 0x000003FF) << 16;
- Packet rightPacket(rightHeader);
+ arm::pipe::Packet rightPacket(rightHeader);
BOOST_CHECK_NO_THROW(commandHandler(rightPacket)); // Right packet
RequestCounterDirectoryCommandHandler commandHandler(familyId, packetId, version, counterDirectory,
sendCounterPacket, sendTimelinePacket, profilingStateMachine);
const uint32_t header = (packetId & 0x000003FF) << 16;
- const Packet packet(header);
+ const arm::pipe::Packet packet(header);
const Device* device = counterDirectory.RegisterDevice("deviceA", 1);
BOOST_CHECK(device != nullptr);
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Connection Acknowledged Packet
- Packet connectionAcknowledgedPacket(header);
+ arm::pipe::Packet connectionAcknowledgedPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(connectionAcknowledgedPacket));
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Request Counter Directory packet
- Packet requestCounterDirectoryPacket(header);
+ arm::pipe::Packet requestCounterDirectoryPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(requestCounterDirectoryPacket));
WriteUint16(data.get(), 6, counterUidB);
// Create the Periodic Counter Selection packet
- Packet periodicCounterSelectionPacket(header, length, data); // Length > 0, this will start the Period Counter
- // Capture thread
+ // Length > 0, this will start the Period Counter Capture thread
+ arm::pipe::Packet periodicCounterSelectionPacket(header, length, data);
+
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Periodic Counter Selection packet
- Packet periodicCounterSelectionPacket(header); // Length == 0, this will disable the collection of counters
+ // Length == 0, this will disable the collection of counters
+ arm::pipe::Packet periodicCounterSelectionPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
WriteUint16(data.get(), 4, counterUid);
// Create the Periodic Counter Selection packet
- Packet periodicCounterSelectionPacket(header, length, data); // Length > 0, this will start the Period Counter
- // Capture thread
+ // Length > 0, this will start the Period Counter Capture thread
+ arm::pipe::Packet periodicCounterSelectionPacket(header, length, data);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
WriteUint16(data.get(), 6, counterUidB);
// Create the Periodic Counter Selection packet
- Packet periodicCounterSelectionPacket(header, length, data); // Length > 0, this will start the Period Counter
- // Capture thread
+ // Length > 0, this will start the Period Counter Capture thread
+ arm::pipe::Packet periodicCounterSelectionPacket(header, length, data);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Per-Job Counter Selection packet
- Packet periodicCounterSelectionPacket(header); // Length == 0, this will disable the collection of counters
+ // Length == 0, this will disable the collection of counters
+ arm::pipe::Packet periodicCounterSelectionPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Connection Acknowledged Packet
- Packet connectionAcknowledgedPacket(header);
+ arm::pipe::Packet connectionAcknowledgedPacket(header);
// Write an invalid "Connection Acknowledged" packet into the mock profiling connection, to simulate an invalid
// reply from an external profiling service
mockProfilingConnection->WritePacket(std::move(connectionAcknowledgedPacket));
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Request Counter Directory packet
- Packet requestCounterDirectoryPacket(header);
+ arm::pipe::Packet requestCounterDirectoryPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(requestCounterDirectoryPacket));
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Periodic Counter Selection packet
- Packet periodicCounterSelectionPacket(header); // Length == 0, this will disable the collection of counters
+ // Length == 0, this will disable the collection of counters
+ arm::pipe::Packet periodicCounterSelectionPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
#include <armnn/Logging.hpp>
#include <armnn/utility/PolymorphicDowncast.hpp>
-#include <CommandHandlerFunctor.hpp>
#include <IProfilingConnection.hpp>
#include <ProfilingService.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+
+
#include <boost/test/unit_test.hpp>
#include <chrono>
return false;
}
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
// First time we're called return a connection ack packet. After that always timeout.
if (m_FirstCall)
{
m_FirstCall = false;
// Return connection acknowledged packet
- return Packet(65536);
+ return arm::pipe::Packet(65536);
}
else
{
: m_ReadRequests(0)
{}
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
// Return connection acknowledged packet after three timeouts
if (m_ReadRequests % 3 == 0)
throw armnn::TimeoutException("Simulate a timeout error\n");
}
- return Packet(65536);
+ return arm::pipe::Packet(65536);
}
int ReadCalledCount()
: m_ReadRequests(0)
{}
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
IgnoreUnused(timeout);
++m_ReadRequests;
class TestProfilingConnectionBadAckPacket : public TestProfilingConnectionBase
{
public:
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
IgnoreUnused(timeout);
// Connection Acknowledged Packet header (word 0, word 1 is always zero):
uint32_t packetId = 37; // Wrong packet id!!!
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
- return Packet(header);
+ return arm::pipe::Packet(header);
}
};
-class TestFunctorA : public CommandHandlerFunctor
+class TestFunctorA : public arm::pipe::CommandHandlerFunctor
{
public:
using CommandHandlerFunctor::CommandHandlerFunctor;
int GetCount() { return m_Count; }
- void operator()(const Packet& packet) override
+ void operator()(const arm::pipe::Packet& packet) override
{
IgnoreUnused(packet);
m_Count++;
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "RequestCountersPacketHandler.hpp"
#include "DirectoryCaptureCommandHandler.hpp"
-#include "PacketVersionResolver.hpp"
+#include <common/include/PacketVersionResolver.hpp>
#include <common/include/ProfilingException.hpp>
return headers;
}
-void RequestCountersPacketHandler::HandlePacket(const Packet& packet)
+void RequestCountersPacketHandler::HandlePacket(const arm::pipe::Packet& packet)
{
if (packet.GetHeader() != m_CounterDirectoryMessageHeader)
{
return;
}
- armnn::profiling::PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
DirectoryCaptureCommandHandler directoryCaptureCommandHandler(
0, 2, packetVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue());
directoryCaptureCommandHandler.operator()(packet);
offset += uint16_t_size;
}
- Packet packet(0x40000, bodySize, uniqueData);
+ arm::pipe::Packet packet(0x40000, bodySize, uniqueData);
m_Connection->ReturnPacket(packet);
}
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include <armnn/Types.hpp>
#include <armnn/profiling/ILocalPacketHandler.hpp>
-#include "Packet.hpp"
#include "ProfilingUtils.hpp"
+#include <common/include/Packet.hpp>
+
namespace armnn
{
std::vector<uint32_t> GetHeadersAccepted() override; // ILocalPacketHandler
- void HandlePacket(const Packet& packet) override; // ILocalPacketHandler
+ void HandlePacket(const arm::pipe::Packet& packet) override; // ILocalPacketHandler
void SetConnection(IInternalProfilingConnection* profilingConnection) override // ILocalPacketHandler
{
#include <BufferManager.hpp>
#include <CounterDirectory.hpp>
-#include <EncodeVersion.hpp>
+#include <common/include/EncodeVersion.hpp>
#include <ProfilingUtils.hpp>
#include <SendCounterPacket.hpp>
#include <Processes.hpp>
// Timeline Message Directory (packet_family = 1, packet_class = 0, packet_type = 0) Version 1.0.0
// Timeline Message (packet_family = 1, packet_class = 0, packet_type = 1) Version 1.0.0
std::vector<std::pair<uint32_t, uint32_t>> packetVersions;
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 1), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 2), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 3), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 4), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 5), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 6), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 7), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 1), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 1), EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 2), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 3), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 4), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 5), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 6), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 7), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 1), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
uint32_t packetEntries = static_cast<uint32_t>(packetVersions.size());
BOOST_TEST(headerWord1 == totalLength - (2 * sizeUint32)); // data length
uint32_t offset = sizeUint32 * 2;
- BOOST_TEST(ReadUint32(readBuffer2, offset) == armnnProfiling::PIPE_MAGIC); // pipe_magic
+ BOOST_TEST(ReadUint32(readBuffer2, offset) == arm::pipe::PIPE_MAGIC); // pipe_magic
offset += sizeUint32;
- BOOST_TEST(ReadUint32(readBuffer2, offset) == EncodeVersion(1, 0, 0)); // stream_metadata_version
+ BOOST_TEST(ReadUint32(readBuffer2, offset) == arm::pipe::EncodeVersion(1, 0, 0)); // stream_metadata_version
offset += sizeUint32;
BOOST_TEST(ReadUint32(readBuffer2, offset) == MAX_METADATA_PACKET_LENGTH); // max_data_len
offset += sizeUint32;
#include "ProfilingMocks.hpp"
#include <BufferManager.hpp>
-#include <Threads.hpp>
+#include <LabelsAndEventClasses.hpp>
#include <ProfilingService.hpp>
#include <ProfilingUtils.hpp>
#include <SendTimelinePacket.hpp>
+#include <Threads.hpp>
#include <TimelinePacketWriterFactory.hpp>
+#include <common/include/SwTrace.hpp>
+
#include <boost/test/unit_test.hpp>
-#include <LabelsAndEventClasses.hpp>
#include <functional>
#include <Runtime.hpp>
BOOST_CHECK(DeclCount == 5);
offset += uint32_t_size;
- SwTraceMessage swTraceMessage = ReadSwTraceMessage(packetBuffer->GetReadableData(),
- offset,
- packetBuffer->GetSize());
+ arm::pipe::SwTraceMessage swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
+ offset,
+ packetBuffer->GetSize());
BOOST_CHECK(swTraceMessage.m_Id == 0);
BOOST_CHECK(swTraceMessage.m_Name == "declareLabel");
BOOST_CHECK(swTraceMessage.m_ArgNames[0] == "guid");
BOOST_CHECK(swTraceMessage.m_ArgNames[1] == "value");
- swTraceMessage = ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize());
+ swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
+ offset,
+ packetBuffer->GetSize());
BOOST_CHECK(swTraceMessage.m_Id == 1);
BOOST_CHECK(swTraceMessage.m_Name == "declareEntity");
BOOST_CHECK(swTraceMessage.m_ArgNames.size() == 1);
BOOST_CHECK(swTraceMessage.m_ArgNames[0] == "guid");
- swTraceMessage = ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize());
+ swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
+ offset,
+ packetBuffer->GetSize());
BOOST_CHECK(swTraceMessage.m_Id == 2);
BOOST_CHECK(swTraceMessage.m_Name == "declareEventClass");
BOOST_CHECK(swTraceMessage.m_ArgNames[0] == "guid");
BOOST_CHECK(swTraceMessage.m_ArgNames[1] == "nameGuid");
- swTraceMessage = ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize());
+ swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
+ offset,
+ packetBuffer->GetSize());
BOOST_CHECK(swTraceMessage.m_Id == 3);
BOOST_CHECK(swTraceMessage.m_Name == "declareRelationship");
BOOST_CHECK(swTraceMessage.m_ArgNames[3] == "tailGuid");
BOOST_CHECK(swTraceMessage.m_ArgNames[4] == "attributeGuid");
- swTraceMessage = ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize());
+ swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
+ offset,
+ packetBuffer->GetSize());
BOOST_CHECK(swTraceMessage.m_Id == 4);
BOOST_CHECK(swTraceMessage.m_Name == "declareEvent");
#include "IProfilingConnection.hpp"
#include <LabelsAndEventClasses.hpp>
-#include <armnn/utility/IgnoreUnused.hpp>
-
#include <chrono>
#include <iostream>
-#include <sstream>
namespace armnn
{
return headers;
}
-void TestTimelinePacketHandler::HandlePacket(const Packet& packet)
+void TestTimelinePacketHandler::HandlePacket(const arm::pipe::Packet& packet)
{
if (packet.GetHeader() == m_DirectoryHeader)
{
m_InferenceCompletedConditionVariable.notify_one();
}
-void TestTimelinePacketHandler::ProcessDirectoryPacket(const Packet& packet)
+void TestTimelinePacketHandler::ProcessDirectoryPacket(const arm::pipe::Packet& packet)
{
m_DirectoryDecoder(packet);
}
-void TestTimelinePacketHandler::ProcessMessagePacket(const Packet& packet)
+void TestTimelinePacketHandler::ProcessMessagePacket(const arm::pipe::Packet& packet)
{
m_Decoder(packet);
}
// TimelineMessageDecoder functions
-ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEntity(const Entity& entity)
+arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEntity(const Entity& entity)
{
m_TimelineModel.AddEntity(entity.m_Guid);
- return ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
+ return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
}
-ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEventClass(
- const ITimelineDecoder::EventClass& eventClass)
+arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEventClass(
+ const arm::pipe::ITimelineDecoder::EventClass& eventClass)
{
m_TimelineModel.AddEventClass(eventClass);
- return ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
+ return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
}
-ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEvent(const ITimelineDecoder::Event& event)
+arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEvent(
+ const arm::pipe::ITimelineDecoder::Event& event)
{
m_TimelineModel.AddEvent(event);
- return ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
+ return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
}
-ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateLabel(const ITimelineDecoder::Label& label)
+arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateLabel(
+ const arm::pipe::ITimelineDecoder::Label& label)
{
m_TimelineModel.AddLabel(label);
- return ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
+ return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
}
-ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateRelationship(
- const ITimelineDecoder::Relationship& relationship)
+arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateRelationship(
+ const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
m_TimelineModel.AddRelationship(relationship);
// check to see if this is an execution link to an inference of event class end of life
}
}
}
- return ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
+ return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
}
} // namespace profiling
#pragma once
#include <armnn/profiling/ILocalPacketHandler.hpp>
-#include <armnn/profiling/ITimelineDecoder.hpp>
-#include <Packet.hpp>
+#include <server/include/timelineDecoder/ITimelineDecoder.hpp>
#include "ProfilingUtils.hpp"
-#include "TimelineCaptureCommandHandler.hpp"
-#include "TimelineDirectoryCaptureCommandHandler.hpp"
+#include <server/include/timelineDecoder/TimelineCaptureCommandHandler.hpp>
+#include <server/include/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp>
#include "TimelineModel.hpp"
+#include <common/include/Packet.hpp>
+
#include <condition_variable>
#include <map>
#include <mutex>
// forward declaration of class
class TestTimelinePacketHandler;
-class TimelineMessageDecoder : public ITimelineDecoder
+class TimelineMessageDecoder : public arm::pipe::ITimelineDecoder
{
public:
TimelineMessageDecoder(TimelineModel& model) : m_PacketHandler(nullptr), m_TimelineModel(model) {}
virtual std::vector<uint32_t> GetHeadersAccepted() override; // ILocalPacketHandler
- virtual void HandlePacket(const Packet& packet) override; // ILocalPacketHandler
+ virtual void HandlePacket(const arm::pipe::Packet& packet) override; // ILocalPacketHandler
void Stop();
}
private:
- void ProcessDirectoryPacket(const Packet& packet);
- void ProcessMessagePacket(const Packet& packet);
+ void ProcessDirectoryPacket(const arm::pipe::Packet& packet);
+ void ProcessMessagePacket(const arm::pipe::Packet& packet);
IInternalProfilingConnection* m_Connection;
std::mutex m_InferenceCompletedMutex;
std::condition_variable m_InferenceCompletedConditionVariable;
uint32_t m_DirectoryHeader;
uint32_t m_MessageHeader;
TimelineMessageDecoder m_MessageDecoder;
- timelinedecoder::TimelineCaptureCommandHandler m_Decoder;
- timelinedecoder::TimelineDirectoryCaptureCommandHandler m_DirectoryDecoder;
+ arm::pipe::TimelineCaptureCommandHandler m_Decoder;
+ arm::pipe::TimelineDirectoryCaptureCommandHandler m_DirectoryDecoder;
};
} // namespace profiling
namespace profiling
{
-void TimelineModel::AddLabel(const ITimelineDecoder::Label& label)
+void TimelineModel::AddLabel(const arm::pipe::ITimelineDecoder::Label& label)
{
m_LabelMap.emplace(label.m_Guid, label);
}
}
}
-void TimelineModel::AddRelationship(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::AddRelationship(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
m_Relationships.emplace(relationship.m_Guid, relationship);
- if (relationship.m_RelationshipType == ITimelineDecoder::RelationshipType::LabelLink)
+ if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::LabelLink)
{
HandleLabelLink(relationship);
}
- else if (relationship.m_RelationshipType == ITimelineDecoder::RelationshipType::RetentionLink)
+ else if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink)
{
// Take care of the special case of a connection between layers in ArmNN
// modelled by a retention link between two layer entities with an attribute GUID
// report unknown relationship type
std::stringstream ss;
ss << "Encountered a RetentionLink of unknown type [" << relationship.m_AttributeGuid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
}
- else if (relationship.m_RelationshipType == ITimelineDecoder::RelationshipType::ExecutionLink)
+ else if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink)
{
HandleExecutionLink(relationship);
}
}
-void TimelineModel::HandleLabelLink(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::HandleLabelLink(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
Entity* entity = FindEntity(relationship.m_HeadGuid);
// we have a label attribute of an entity
std::stringstream ss;
ss << "could not find label link [" << relationship.m_Guid <<
"] value [" << relationship.m_TailGuid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
if (relationship.m_AttributeGuid != 0)
{
std::stringstream ss;
ss << "could not find label link [" << relationship.m_Guid <<
"] attribute [" << relationship.m_AttributeGuid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
}
else
//report an error
std::stringstream ss;
ss << "label link [" << relationship.m_Guid << "] has a zero attribute guid";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
if (entity != nullptr && attribute != nullptr && value != nullptr)
{
{
ss << "attribute [" << *attribute << "] ";
}
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
}
-void TimelineModel::HandleConnection(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::HandleConnection(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
Entity* outputLayer = FindEntity(relationship.m_HeadGuid);
if (outputLayer == nullptr)
std::stringstream ss;
ss << "could not find output entity [" << relationship.m_HeadGuid << "]";
ss << " of connection [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
Entity* inputLayer = FindEntity(relationship.m_TailGuid);
std::stringstream ss;
ss << "could not find input entity [" << relationship.m_TailGuid << "]";
ss << " of connection [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
Connection connection(relationship.m_Guid, outputLayer, inputLayer);
outputLayer->AddConnection(connection);
}
-void TimelineModel::HandleChild(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::HandleChild(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
Entity* parentEntity = FindEntity(relationship.m_HeadGuid);
if (parentEntity == nullptr)
std::stringstream ss;
ss << "could not find parent entity [" << relationship.m_HeadGuid << "]";
ss << " of child relationship [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
Entity* childEntity = FindEntity(relationship.m_TailGuid);
std::stringstream ss;
ss << "could not find child entity [" << relationship.m_TailGuid << "]";
ss << " of child relationship [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
parentEntity->AddChild(childEntity);
}
-void TimelineModel::HandleExecutionOf(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::HandleExecutionOf(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
Entity* parentEntity = FindEntity(relationship.m_HeadGuid);
if (parentEntity == nullptr)
std::stringstream ss;
ss << "could not find parent entity [" << relationship.m_HeadGuid << "]";
ss << " of execution relationship [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
Entity* executedEntity = FindEntity(relationship.m_TailGuid);
std::stringstream ss;
ss << "could not find executed entity [" << relationship.m_TailGuid << "]";
ss << " of execution relationship [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
parentEntity->AddExecution(executedEntity);
}
-void TimelineModel::HandleExecutionLink(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::HandleExecutionLink(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
// entityGuid,
Entity* parentEntity = FindEntity(relationship.m_HeadGuid);
std::stringstream ss;
ss << "could not find entity [" << relationship.m_HeadGuid << "]";
ss << " of ExecutionLink [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
// eventGuid,
std::stringstream ss;
ss << "could not find event [" << relationship.m_TailGuid << "]";
ss << " of ExecutionLink [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
// eventClassGuid
std::stringstream ss;
ss << "could not find event class [" << relationship.m_TailGuid << "]";
ss << " of ExecutionLink [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
eventObj->SetEventClass(eventClassObj);
return it != m_InferenceGuids.end();
}
-void TimelineModel::AddEventClass(const ITimelineDecoder::EventClass& eventClass)
+void TimelineModel::AddEventClass(const arm::pipe::ITimelineDecoder::EventClass& eventClass)
{
std::string* eventClassName = FindLabel(eventClass.m_NameGuid);
if (eventClassName != nullptr)
std::stringstream ss;
ss << "could not find name [" << eventClass.m_NameGuid << "]";
ss << " of of event class [" << eventClass.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
}
}
}
-void TimelineModel::AddEvent(const ITimelineDecoder::Event& event)
+void TimelineModel::AddEvent(const arm::pipe::ITimelineDecoder::Event& event)
{
EventObj evt(event.m_Guid, event.m_TimeStamp, event.m_ThreadId);
m_Events.emplace(event.m_Guid, evt);
#pragma once
-#include <armnn/profiling/ITimelineDecoder.hpp>
#include <common/include/ProfilingException.hpp>
+#include <server/include/timelineDecoder/ITimelineDecoder.hpp>
#include <map>
#include <sstream>
namespace profiling
{
-using LabelMap = std::map<uint64_t, ITimelineDecoder::Label>;
+using LabelMap = std::map<uint64_t, arm::pipe::ITimelineDecoder::Label>;
using Attribute = std::pair<std::string, std::string>;
using Attributes = std::map<std::string, Attribute>;
class Entity;
{
std::stringstream ss;
ss << "connection [" << guid << "] head cannot be null";
- throw armnnProfiling::ProfilingException(ss.str());
+ throw arm::pipe::ProfilingException(ss.str());
}
if (tail == nullptr)
{
std::stringstream ss;
ss << "connection [" << guid << "] tail cannot be null";
- throw armnnProfiling::ProfilingException(ss.str());
+ throw arm::pipe::ProfilingException(ss.str());
}
}
using Entities = std::map<uint64_t, Entity>;
struct ModelRelationship
{
- ModelRelationship(const ITimelineDecoder::Relationship& relationship) : m_Relationship(relationship) {}
- ITimelineDecoder::Relationship m_Relationship;
+ ModelRelationship(const arm::pipe::ITimelineDecoder::Relationship& relationship) : m_Relationship(relationship) {}
+ arm::pipe::ITimelineDecoder::Relationship m_Relationship;
std::vector<Entity*> m_RelatedEntities;
};
using Relationships = std::map<uint64_t, ModelRelationship>;
class TimelineModel
{
public:
- void AddLabel(const ITimelineDecoder::Label& label);
+ void AddLabel(const arm::pipe::ITimelineDecoder::Label& label);
std::string* FindLabel(uint64_t guid);
void AddEntity(uint64_t guid);
Entity* FindEntity(uint64_t id);
- void AddRelationship(const ITimelineDecoder::Relationship& relationship);
+ void AddRelationship(const arm::pipe::ITimelineDecoder::Relationship& relationship);
ModelRelationship* FindRelationship(uint64_t id);
const LabelMap& GetLabelMap() const {return m_LabelMap;}
const Entities& GetEntities() const {return m_Entities;}
- const std::vector<armnnProfiling::ProfilingException>& GetErrors() const {return m_Errors;}
+ const std::vector<arm::pipe::ProfilingException>& GetErrors() const {return m_Errors;}
bool IsInferenceGuid(uint64_t guid) const;
- void AddEventClass(const ITimelineDecoder::EventClass& eventClass);
+ void AddEventClass(const arm::pipe::ITimelineDecoder::EventClass& eventClass);
const EventClasses& GetEventClasses() const {return m_EventClasses;}
EventClassObj* FindEventClass(uint64_t id);
- void AddEvent(const ITimelineDecoder::Event& event);
+ void AddEvent(const arm::pipe::ITimelineDecoder::Event& event);
EventObj* FindEvent(uint64_t id);
private:
LabelMap m_LabelMap;
Entities m_Entities;
Relationships m_Relationships;
- std::vector<armnnProfiling::ProfilingException> m_Errors;
+ std::vector<arm::pipe::ProfilingException> m_Errors;
std::vector<uint64_t> m_InferenceGuids;
EventClasses m_EventClasses;
Events m_Events;
- void HandleLabelLink(const ITimelineDecoder::Relationship& relationship);
- void HandleConnection(const ITimelineDecoder::Relationship& relationship);
- void HandleChild(const ITimelineDecoder::Relationship& relationship);
- void HandleExecutionOf(const ITimelineDecoder::Relationship& relationship);
- void HandleExecutionLink(const ITimelineDecoder::Relationship& relationship);
+ void HandleLabelLink(const arm::pipe::ITimelineDecoder::Relationship& relationship);
+ void HandleConnection(const arm::pipe::ITimelineDecoder::Relationship& relationship);
+ void HandleChild(const arm::pipe::ITimelineDecoder::Relationship& relationship);
+ void HandleExecutionOf(const arm::pipe::ITimelineDecoder::Relationship& relationship);
+ void HandleExecutionLink(const arm::pipe::ITimelineDecoder::Relationship& relationship);
};
std::vector<std::string> GetModelDescription(const TimelineModel& model);
#include <Threads.hpp>
#include <ProfilingUtils.hpp>
+#include <common/include/SwTrace.hpp>
+
#include <boost/test/unit_test.hpp>
#include <boost/numeric/conversion/cast.hpp>
// Check the ui_name
std::vector<uint32_t> swTraceString;
- StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString);
+ arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
uint32_t swTraceUINameLength = ReadUint32(buffer.data(), offset);
BOOST_CHECK(swTraceUINameLength == 14); // ui_name length including the null-terminator
swTraceUINameLength - 1) == 0); // The length of the label
// Check arg_types
- StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString);
+ arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
uint32_t swTraceArgTypesLength = ReadUint32(buffer.data(), offset);
BOOST_CHECK(swTraceArgTypesLength == 3); // arg_types length including the null-terminator
swTraceArgTypesLength - 1) == 0); // The length of the label
// Check arg_names
- StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString);
+ arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
uint32_t swTraceArgNamesLength = ReadUint32(buffer.data(), offset);
BOOST_CHECK(swTraceArgNamesLength == 11); // arg_names length including the null-terminator
swTraceArgNamesLength - 1) == 0); // The length of the label
// Check second message decl_id
- StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString);
+ arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
readDeclId = ReadUint32(buffer.data(), offset);
BOOST_CHECK(readDeclId == 1);
#
-# Copyright © 2020 Arm Ltd. All rights reserved.
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
# SPDX-License-Identifier: MIT
#
if(BUILD_TIMELINE_DECODER)
- set(timelineDecoder_sources)
- list(APPEND timelineDecoder_sources
- ${PROJECT_SOURCE_DIR}/include/armnn/profiling/ITimelineDecoder.hpp
- TimelineCaptureCommandHandler.cpp
- TimelineCaptureCommandHandler.hpp
+ set(jsonTimelineDecoder_sources)
+ list(APPEND jsonTimelineDecoder_sources
JSONTimelineDecoder.cpp
- JSONTimelineDecoder.hpp
- TimelineDecoder.cpp
- TimelineDecoder.hpp
- TimelineDirectoryCaptureCommandHandler.cpp
- TimelineDirectoryCaptureCommandHandler.hpp)
+ JSONTimelineDecoder.hpp)
include_directories(${PROJECT_SOURCE_DIR}/src/profiling
${PROJECT_SOURCE_DIR}/profiling/common/include
+ ${PROJECT_SOURCE_DIR}/profiling/server/include/timelineDecoder
${PROJECT_SOURCE_DIR}/src/armnnUtils)
if(BUILD_UNIT_TESTS)
target_include_directories(UnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/timelineDecoder)
endif()
- add_library_ex(timelineDecoder SHARED ${timelineDecoder_sources})
+ add_library_ex(jsonTimelineDecoder SHARED ${jsonTimelineDecoder_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} )
+ set_target_properties(jsonTimelineDecoder PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
+ set_target_properties(jsonTimelineDecoder PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
- target_link_libraries(timelineDecoder armnn)
+ target_link_libraries(jsonTimelineDecoder armnn)
- install(TARGETS timelineDecoder
+ install(TARGETS jsonTimelineDecoder
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
#include "../profiling/ProfilingUtils.hpp"
#include <string>
-#include <fstream>
namespace armnn
{
#pragma once
-#include <armnn/profiling/ITimelineDecoder.hpp>
+#include <server/include/timelineDecoder/ITimelineDecoder.hpp>
#include <Filesystem.hpp>
#include <map>
{
namespace timelinedecoder
{
-class JSONTimelineDecoder : public ITimelineDecoder
+class JSONTimelineDecoder : public arm::pipe::ITimelineDecoder
{
public:
struct JSONEntity
//
#include <JSONTimelineDecoder.hpp>
-#include <TimelineCaptureCommandHandler.hpp>
-#include <TimelineDecoder.hpp>
+#include <server/include/timelineDecoder/TimelineCaptureCommandHandler.hpp>
+#include <server/include/timelineDecoder/TimelineDecoder.hpp>
#include <Filesystem.hpp>
#include <boost/test/test_tools.hpp>
/*
* Building Simple model structure to test
*/
- ITimelineDecoder::Label name;
+ arm::pipe::ITimelineDecoder::Label name;
name.m_Guid = uint64_t(10420554295983197538U);
name.m_Name = "name";
timelineDecoder.CreateLabel(name);
- ITimelineDecoder::Label type;
+ arm::pipe::ITimelineDecoder::Label type;
type.m_Guid = uint64_t(14196220359693045352U);
type.m_Name = "type";
timelineDecoder.CreateLabel(type);
- ITimelineDecoder::Label index;
+ arm::pipe::ITimelineDecoder::Label index;
index.m_Guid = uint64_t(13922236767355949814U);
index.m_Name = "index";
timelineDecoder.CreateLabel(index);
- ITimelineDecoder::Label backendId;
+ arm::pipe::ITimelineDecoder::Label backendId;
backendId.m_Guid = uint64_t(10874037804557439415U);
backendId.m_Name = "backendId";
timelineDecoder.CreateLabel(backendId);
- ITimelineDecoder::Label layer;
+ arm::pipe::ITimelineDecoder::Label layer;
layer.m_Guid = uint64_t(14761340794127440397U);
layer.m_Name = "layer";
timelineDecoder.CreateLabel(layer);
- ITimelineDecoder::Label workload;
+ arm::pipe::ITimelineDecoder::Label workload;
workload.m_Guid = uint64_t(15704252740552608110U);
workload.m_Name = "workload";
timelineDecoder.CreateLabel(workload);
- ITimelineDecoder::Label network;
+ arm::pipe::ITimelineDecoder::Label network;
network.m_Guid = uint64_t(16862199137063532871U);
network.m_Name = "network";
timelineDecoder.CreateLabel(network);
- ITimelineDecoder::Label connection;
+ arm::pipe::ITimelineDecoder::Label connection;
connection.m_Guid = uint64_t(15733717748792475675U);
connection.m_Name = "connection";
timelineDecoder.CreateLabel(connection);
- ITimelineDecoder::Label inference;
+ arm::pipe::ITimelineDecoder::Label inference;
inference.m_Guid = uint64_t(15026600058430441282U);
inference.m_Name = "inference";
timelineDecoder.CreateLabel(inference);
- ITimelineDecoder::Label workload_execution;
+ arm::pipe::ITimelineDecoder::Label workload_execution;
workload_execution.m_Guid = uint64_t(10172155312650606003U);
workload_execution.m_Name = "workload_execution";
timelineDecoder.CreateLabel(workload_execution);
- ITimelineDecoder::EventClass eventClass1;
+ arm::pipe::ITimelineDecoder::EventClass eventClass1;
eventClass1.m_Guid = uint64_t(17170418158534996719U);
timelineDecoder.CreateEventClass(eventClass1);
- ITimelineDecoder::EventClass eventClass2;
+ arm::pipe::ITimelineDecoder::EventClass eventClass2;
eventClass2.m_Guid = uint64_t(10812061579584851344U);
timelineDecoder.CreateEventClass(eventClass2);
- ITimelineDecoder::Entity entity6;
+ arm::pipe::ITimelineDecoder::Entity entity6;
entity6.m_Guid = uint64_t(6);
timelineDecoder.CreateEntity(entity6);
- ITimelineDecoder::Relationship relationship7;
+ arm::pipe::ITimelineDecoder::Relationship relationship7;
relationship7.m_Guid = uint64_t(7);
- relationship7.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship7.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship7.m_HeadGuid = uint64_t(6);
relationship7.m_TailGuid = uint64_t(16862199137063532871U);
timelineDecoder.CreateRelationship(relationship7);
- ITimelineDecoder::Relationship relationship8;
+ arm::pipe::ITimelineDecoder::Relationship relationship8;
relationship8.m_Guid = uint64_t(8);
- relationship8.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship8.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship8.m_HeadGuid = uint64_t(7);
relationship8.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship8);
// Adding normalization layer
- ITimelineDecoder::Entity entity0;
+ arm::pipe::ITimelineDecoder::Entity entity0;
entity0.m_Guid = uint64_t(0);
timelineDecoder.CreateEntity(entity0);
- ITimelineDecoder::Label input;
+ arm::pipe::ITimelineDecoder::Label input;
input.m_Guid = uint64_t(18179123836411086572U);
input.m_Name = "input";
timelineDecoder.CreateLabel(input);
- ITimelineDecoder::Relationship relationship9;
+ arm::pipe::ITimelineDecoder::Relationship relationship9;
relationship9.m_Guid = uint64_t(9);
- relationship9.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship9.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship9.m_HeadGuid = uint64_t(0);
relationship9.m_TailGuid = uint64_t(18179123836411086572U);
timelineDecoder.CreateRelationship(relationship9);
- ITimelineDecoder::Relationship relationship10;
+ arm::pipe::ITimelineDecoder::Relationship relationship10;
relationship10.m_Guid = uint64_t(10);
- relationship10.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship10.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship10.m_HeadGuid = uint64_t(9);
relationship10.m_TailGuid = uint64_t(10420554295983197538U);
timelineDecoder.CreateRelationship(relationship10);
- ITimelineDecoder::Relationship relationship11;
+ arm::pipe::ITimelineDecoder::Relationship relationship11;
relationship11.m_Guid = uint64_t(11);
- relationship11.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship11.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship11.m_HeadGuid = uint64_t(0);
relationship11.m_TailGuid = uint64_t(14761340794127440397U);
timelineDecoder.CreateRelationship(relationship11);
- ITimelineDecoder::Relationship relationship12;
+ arm::pipe::ITimelineDecoder::Relationship relationship12;
relationship12.m_Guid = uint64_t(12);
- relationship12.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship12.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship12.m_HeadGuid = uint64_t(11);
relationship12.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship12);
- ITimelineDecoder::Relationship relationship13;
+ arm::pipe::ITimelineDecoder::Relationship relationship13;
relationship13.m_Guid = uint64_t(13);
- relationship13.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship13.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship13.m_HeadGuid = uint64_t(6);
relationship13.m_TailGuid = uint64_t(0);
timelineDecoder.CreateRelationship(relationship13);
// Adding normalization layer
- ITimelineDecoder::Entity entity1;
+ arm::pipe::ITimelineDecoder::Entity entity1;
entity1.m_Guid = uint64_t(1);
timelineDecoder.CreateEntity(entity1);
- ITimelineDecoder::Label normalization;
+ arm::pipe::ITimelineDecoder::Label normalization;
normalization.m_Guid = uint64_t(15955949569988957863U);
normalization.m_Name = "normalization";
timelineDecoder.CreateLabel(normalization);
- ITimelineDecoder::Relationship relationship14;
+ arm::pipe::ITimelineDecoder::Relationship relationship14;
relationship14.m_Guid = uint64_t(14);
- relationship14.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship14.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship14.m_HeadGuid = uint64_t(1);
relationship14.m_TailGuid = uint64_t(15955949569988957863U);
timelineDecoder.CreateRelationship(relationship14);
- ITimelineDecoder::Relationship relationship15;
+ arm::pipe::ITimelineDecoder::Relationship relationship15;
relationship15.m_Guid = uint64_t(15);
- relationship15.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship15.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship15.m_HeadGuid = uint64_t(14);
relationship15.m_TailGuid = uint64_t(10420554295983197538U);
timelineDecoder.CreateRelationship(relationship15);
- ITimelineDecoder::Relationship relationship16;
+ arm::pipe::ITimelineDecoder::Relationship relationship16;
relationship16.m_Guid = uint64_t(16);
- relationship16.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship16.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship16.m_HeadGuid = uint64_t(1);
relationship16.m_TailGuid = uint64_t(14761340794127440397U);
timelineDecoder.CreateRelationship(relationship16);
- ITimelineDecoder::Relationship relationship17;
+ arm::pipe::ITimelineDecoder::Relationship relationship17;
relationship17.m_Guid = uint64_t(17);
- relationship17.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship17.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship17.m_HeadGuid = uint64_t(16);
relationship17.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship17);
- ITimelineDecoder::Relationship relationship18;
+ arm::pipe::ITimelineDecoder::Relationship relationship18;
relationship18.m_Guid = uint64_t(18);
- relationship18.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship18.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship18.m_HeadGuid = uint64_t(6);
relationship18.m_TailGuid = uint64_t(1);
timelineDecoder.CreateRelationship(relationship18);
- ITimelineDecoder::Relationship relationship19;
+ arm::pipe::ITimelineDecoder::Relationship relationship19;
relationship19.m_Guid = uint64_t(19);
- relationship19.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship19.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship19.m_HeadGuid = uint64_t(0);
relationship19.m_TailGuid = uint64_t(1);
timelineDecoder.CreateRelationship(relationship19);
- ITimelineDecoder::Relationship relationship20;
+ arm::pipe::ITimelineDecoder::Relationship relationship20;
relationship20.m_Guid = uint64_t(20);
- relationship20.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship20.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship20.m_HeadGuid = uint64_t(19);
relationship20.m_TailGuid = uint64_t(15733717748792475675U);
timelineDecoder.CreateRelationship(relationship20);
- ITimelineDecoder::Relationship relationship21;
+ arm::pipe::ITimelineDecoder::Relationship relationship21;
relationship21.m_Guid = uint64_t(21);
- relationship21.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship21.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship21.m_HeadGuid = uint64_t(20);
relationship21.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship21);
- ITimelineDecoder::Entity entity22;
+ arm::pipe::ITimelineDecoder::Entity entity22;
entity22.m_Guid = uint64_t(22);
timelineDecoder.CreateEntity(entity22);
- ITimelineDecoder::Relationship relationship23;
+ arm::pipe::ITimelineDecoder::Relationship relationship23;
relationship23.m_Guid = uint64_t(23);
- relationship23.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship23.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship23.m_HeadGuid = uint64_t(22);
relationship23.m_TailGuid = uint64_t(15704252740552608110U);
timelineDecoder.CreateRelationship(relationship23);
- ITimelineDecoder::Relationship relationship24;
+ arm::pipe::ITimelineDecoder::Relationship relationship24;
relationship24.m_Guid = uint64_t(24);
- relationship24.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship24.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship24.m_HeadGuid = uint64_t(23);
relationship24.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship24);
- ITimelineDecoder::Label CpuRef;
+ arm::pipe::ITimelineDecoder::Label CpuRef;
CpuRef.m_Guid = uint64_t(9690680943817437852U);
CpuRef.m_Name = "CpuRef";
timelineDecoder.CreateLabel(CpuRef);
- ITimelineDecoder::Relationship relationship25;
+ arm::pipe::ITimelineDecoder::Relationship relationship25;
relationship25.m_Guid = uint64_t(25);
- relationship25.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship25.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship25.m_HeadGuid = uint64_t(22);
relationship25.m_TailGuid = uint64_t(9690680943817437852U);
timelineDecoder.CreateRelationship(relationship25);
- ITimelineDecoder::Relationship relationship26;
+ arm::pipe::ITimelineDecoder::Relationship relationship26;
relationship26.m_Guid = uint64_t(26);
- relationship26.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship26.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship26.m_HeadGuid = uint64_t(25);
relationship26.m_TailGuid = uint64_t(10874037804557439415U);
timelineDecoder.CreateRelationship(relationship26);
- ITimelineDecoder::Relationship relationship27;
+ arm::pipe::ITimelineDecoder::Relationship relationship27;
relationship27.m_Guid = uint64_t(27);
- relationship27.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink ;
+ relationship27.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink ;
relationship27.m_HeadGuid = uint64_t(1);
relationship27.m_TailGuid = uint64_t(22);
timelineDecoder.CreateRelationship(relationship27);
// Adding output layer
- ITimelineDecoder::Entity entity2;
+ arm::pipe::ITimelineDecoder::Entity entity2;
entity2.m_Guid = uint64_t(2);
timelineDecoder.CreateEntity(entity2);
- ITimelineDecoder::Label output;
+ arm::pipe::ITimelineDecoder::Label output;
output.m_Guid = uint64_t(18419179028513879730U);
output.m_Name = "output";
timelineDecoder.CreateLabel(output);
- ITimelineDecoder::Relationship relationship28;
+ arm::pipe::ITimelineDecoder::Relationship relationship28;
relationship28.m_Guid = uint64_t(28);
- relationship28.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship28.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship28.m_HeadGuid = uint64_t(2);
relationship28.m_TailGuid = uint64_t(18419179028513879730U);
timelineDecoder.CreateRelationship(relationship28);
- ITimelineDecoder::Relationship relationship29;
+ arm::pipe::ITimelineDecoder::Relationship relationship29;
relationship29.m_Guid = uint64_t(29);
- relationship29.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship29.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship29.m_HeadGuid = uint64_t(28);
relationship29.m_TailGuid = uint64_t(10420554295983197538U);
timelineDecoder.CreateRelationship(relationship29);
- ITimelineDecoder::Relationship relationship30;
+ arm::pipe::ITimelineDecoder::Relationship relationship30;
relationship30.m_Guid = uint64_t(30);
- relationship30.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship30.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship30.m_HeadGuid = uint64_t(2);
relationship30.m_TailGuid = uint64_t(14761340794127440397U);
timelineDecoder.CreateRelationship(relationship30);
- ITimelineDecoder::Relationship relationship31;
+ arm::pipe::ITimelineDecoder::Relationship relationship31;
relationship31.m_Guid = uint64_t(31);
- relationship31.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship31.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship31.m_HeadGuid = uint64_t(30);
relationship31.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship31);
- ITimelineDecoder::Relationship relationship32;
+ arm::pipe::ITimelineDecoder::Relationship relationship32;
relationship32.m_Guid = uint64_t(32);
- relationship32.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship32.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship32.m_HeadGuid = uint64_t(6);
relationship32.m_TailGuid = uint64_t(2);
timelineDecoder.CreateRelationship(relationship32);
- ITimelineDecoder::Relationship relationship33;
+ arm::pipe::ITimelineDecoder::Relationship relationship33;
relationship33.m_Guid = uint64_t(33);
- relationship33.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship33.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship33.m_HeadGuid = uint64_t(1);
relationship33.m_TailGuid = uint64_t(2);
timelineDecoder.CreateRelationship(relationship33);
- ITimelineDecoder::Relationship relationship34;
+ arm::pipe::ITimelineDecoder::Relationship relationship34;
relationship34.m_Guid = uint64_t(34);
- relationship34.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship34.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship34.m_HeadGuid = uint64_t(33);
relationship34.m_TailGuid = uint64_t(15733717748792475675U);
timelineDecoder.CreateRelationship(relationship34);
- ITimelineDecoder::Relationship relationship35;
+ arm::pipe::ITimelineDecoder::Relationship relationship35;
relationship35.m_Guid = uint64_t(35);
- relationship35.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship35.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship35.m_HeadGuid = uint64_t(34);
relationship35.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship35);
- ITimelineDecoder::Entity entity36;
+ arm::pipe::ITimelineDecoder::Entity entity36;
entity36.m_Guid = uint64_t(36);
timelineDecoder.CreateEntity(entity36);
- ITimelineDecoder::Relationship relationship37;
+ arm::pipe::ITimelineDecoder::Relationship relationship37;
relationship37.m_Guid = uint64_t(37);
- relationship37.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship37.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship37.m_HeadGuid = uint64_t(36);
relationship37.m_TailGuid = uint64_t(15704252740552608110U);
timelineDecoder.CreateRelationship(relationship37);
- ITimelineDecoder::Relationship relationship38;
+ arm::pipe::ITimelineDecoder::Relationship relationship38;
relationship38.m_Guid = uint64_t(38);
- relationship38.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship38.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship38.m_HeadGuid = uint64_t(37);
relationship38.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship38);
- ITimelineDecoder::Relationship relationship39;
+ arm::pipe::ITimelineDecoder::Relationship relationship39;
relationship39.m_Guid = uint64_t(39);
- relationship39.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship39.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship39.m_HeadGuid = uint64_t(36);
relationship39.m_TailGuid = uint64_t(9690680943817437852U);
timelineDecoder.CreateRelationship(relationship39);
- ITimelineDecoder::Relationship relationship40;
+ arm::pipe::ITimelineDecoder::Relationship relationship40;
relationship40.m_Guid = uint64_t(40);
- relationship40.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship40.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship40.m_HeadGuid = uint64_t(39);
relationship40.m_TailGuid = uint64_t(10874037804557439415U);
timelineDecoder.CreateRelationship(relationship40);
- ITimelineDecoder::Relationship relationship41;
+ arm::pipe::ITimelineDecoder::Relationship relationship41;
relationship41.m_Guid = uint64_t(41);
- relationship41.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship41.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship41.m_HeadGuid = uint64_t(0);
relationship41.m_TailGuid = uint64_t(36);
timelineDecoder.CreateRelationship(relationship41);
- ITimelineDecoder::Entity entity42;
+ arm::pipe::ITimelineDecoder::Entity entity42;
entity42.m_Guid = uint64_t(42);
timelineDecoder.CreateEntity(entity42);
- ITimelineDecoder::Relationship relationship43;
+ arm::pipe::ITimelineDecoder::Relationship relationship43;
relationship43.m_Guid = uint64_t(43);
- relationship43.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship43.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship43.m_HeadGuid = uint64_t(42);
relationship43.m_TailGuid = uint64_t(15704252740552608110U);
timelineDecoder.CreateRelationship(relationship43);
- ITimelineDecoder::Relationship relationship44;
+ arm::pipe::ITimelineDecoder::Relationship relationship44;
relationship44.m_Guid = uint64_t(44);
- relationship44.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship44.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship44.m_HeadGuid = uint64_t(43);
relationship44.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship44);
- ITimelineDecoder::Relationship relationship45;
+ arm::pipe::ITimelineDecoder::Relationship relationship45;
relationship45.m_Guid = uint64_t(45);
- relationship45.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship45.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship45.m_HeadGuid = uint64_t(42);
relationship45.m_TailGuid = uint64_t(9690680943817437852U);
timelineDecoder.CreateRelationship(relationship45);
- ITimelineDecoder::Relationship relationship46;
+ arm::pipe::ITimelineDecoder::Relationship relationship46;
relationship46.m_Guid = uint64_t(46);
- relationship46.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship46.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship46.m_HeadGuid = uint64_t(45);
relationship46.m_TailGuid = uint64_t(10874037804557439415U);
timelineDecoder.CreateRelationship(relationship46);
- ITimelineDecoder::Relationship relationship47;
+ arm::pipe::ITimelineDecoder::Relationship relationship47;
relationship47.m_Guid = uint64_t(47);
- relationship47.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship47.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship47.m_HeadGuid = uint64_t(2);
relationship47.m_TailGuid = uint64_t(42);
timelineDecoder.CreateRelationship(relationship47);
- ITimelineDecoder::Entity entity48;
+ arm::pipe::ITimelineDecoder::Entity entity48;
entity48.m_Guid = uint64_t(48);
timelineDecoder.CreateEntity(entity48);
- ITimelineDecoder::Relationship relationship49;
+ arm::pipe::ITimelineDecoder::Relationship relationship49;
relationship49.m_Guid = uint64_t(49);
- relationship49.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship49.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship49.m_HeadGuid = uint64_t(48);
relationship49.m_TailGuid = uint64_t(15026600058430441282U);
timelineDecoder.CreateRelationship(relationship49);
- ITimelineDecoder::Relationship relationship50;
+ arm::pipe::ITimelineDecoder::Relationship relationship50;
relationship50.m_Guid = uint64_t(50);
- relationship50.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship50.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship50.m_HeadGuid = uint64_t(49);
relationship50.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship50);
- ITimelineDecoder::Relationship relationship51;
+ arm::pipe::ITimelineDecoder::Relationship relationship51;
relationship51.m_Guid = uint64_t(51);
- relationship51.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship51.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship51.m_HeadGuid = uint64_t(6);
relationship51.m_TailGuid = uint64_t(48);
timelineDecoder.CreateRelationship(relationship51);
- ITimelineDecoder::Relationship relationship53;
+ arm::pipe::ITimelineDecoder::Relationship relationship53;
relationship53.m_Guid = uint64_t(53);
- relationship53.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship53.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship53.m_HeadGuid = uint64_t(48);
relationship53.m_TailGuid = uint64_t(52);
timelineDecoder.CreateRelationship(relationship53);
- ITimelineDecoder::Relationship relationship54;
+ arm::pipe::ITimelineDecoder::Relationship relationship54;
relationship54.m_Guid = uint64_t(54);
- relationship54.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship54.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship54.m_HeadGuid = uint64_t(52);
relationship54.m_TailGuid = uint64_t(17170418158534996719U);
timelineDecoder.CreateRelationship(relationship54);
- ITimelineDecoder::Entity entity55;
+ arm::pipe::ITimelineDecoder::Entity entity55;
entity55.m_Guid = uint64_t(55);
timelineDecoder.CreateEntity(entity55);
- ITimelineDecoder::Relationship relationship56;
+ arm::pipe::ITimelineDecoder::Relationship relationship56;
relationship56.m_Guid = uint64_t(56);
- relationship56.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship56.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship56.m_HeadGuid = uint64_t(55);
relationship56.m_TailGuid = uint64_t(10172155312650606003U);
timelineDecoder.CreateRelationship(relationship56);
- ITimelineDecoder::Relationship relationship57;
+ arm::pipe::ITimelineDecoder::Relationship relationship57;
relationship57.m_Guid = uint64_t(57);
- relationship57.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship57.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship57.m_HeadGuid = uint64_t(56);
relationship57.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship57);
- ITimelineDecoder::Relationship relationship58;
+ arm::pipe::ITimelineDecoder::Relationship relationship58;
relationship58.m_Guid = uint64_t(58);
- relationship58.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship58.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship58.m_HeadGuid = uint64_t(48);
relationship58.m_TailGuid = uint64_t(55);
timelineDecoder.CreateRelationship(relationship58);
- ITimelineDecoder::Relationship relationship59;
+ arm::pipe::ITimelineDecoder::Relationship relationship59;
relationship59.m_Guid = uint64_t(59);
- relationship59.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship59.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship59.m_HeadGuid = uint64_t(36);
relationship59.m_TailGuid = uint64_t(55);
timelineDecoder.CreateRelationship(relationship59);
- ITimelineDecoder::Event event60;
+ arm::pipe::ITimelineDecoder::Event event60;
event60.m_Guid = uint64_t(60);
event60.m_TimeStamp = uint64_t(96557081111036);
event60.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event60);
- ITimelineDecoder::Relationship relationship61;
+ arm::pipe::ITimelineDecoder::Relationship relationship61;
relationship61.m_Guid = uint64_t(61);
- relationship61.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship61.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship61.m_HeadGuid = uint64_t(55);
relationship61.m_TailGuid = uint64_t(60);
timelineDecoder.CreateRelationship(relationship61);
- ITimelineDecoder::Relationship relationship62;
+ arm::pipe::ITimelineDecoder::Relationship relationship62;
relationship62.m_Guid = uint64_t(62);
- relationship62.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship62.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship62.m_HeadGuid = uint64_t(60);
relationship62.m_TailGuid = uint64_t(17170418158534996719U);
timelineDecoder.CreateRelationship(relationship62);
- ITimelineDecoder::Event event63;
+ arm::pipe::ITimelineDecoder::Event event63;
event63.m_Guid = uint64_t(63);
event63.m_TimeStamp = uint64_t(96557081149730);
event63.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event63);
- ITimelineDecoder::Relationship relationship64;
+ arm::pipe::ITimelineDecoder::Relationship relationship64;
relationship64.m_Guid = uint64_t(61);
- relationship64.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship64.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship64.m_HeadGuid = uint64_t(55);
relationship64.m_TailGuid = uint64_t(63);
timelineDecoder.CreateRelationship(relationship64);
- ITimelineDecoder::Relationship relationship65;
+ arm::pipe::ITimelineDecoder::Relationship relationship65;
relationship65.m_Guid = uint64_t(62);
- relationship65.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship65.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship65.m_HeadGuid = uint64_t(63);
relationship65.m_TailGuid = uint64_t(10812061579584851344U);
timelineDecoder.CreateRelationship(relationship65);
- ITimelineDecoder::Entity entity66;
+ arm::pipe::ITimelineDecoder::Entity entity66;
entity66.m_Guid = uint64_t(66);
timelineDecoder.CreateEntity(entity66);
- ITimelineDecoder::Relationship relationship67;
+ arm::pipe::ITimelineDecoder::Relationship relationship67;
relationship67.m_Guid = uint64_t(67);
- relationship67.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship67.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship67.m_HeadGuid = uint64_t(66);
relationship67.m_TailGuid = uint64_t(10172155312650606003U);
timelineDecoder.CreateRelationship(relationship67);
- ITimelineDecoder::Relationship relationship68;
+ arm::pipe::ITimelineDecoder::Relationship relationship68;
relationship68.m_Guid = uint64_t(68);
- relationship68.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship68.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship68.m_HeadGuid = uint64_t(67);
relationship68.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship68);
- ITimelineDecoder::Relationship relationship69;
+ arm::pipe::ITimelineDecoder::Relationship relationship69;
relationship69.m_Guid = uint64_t(69);
- relationship69.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship69.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship69.m_HeadGuid = uint64_t(48);
relationship69.m_TailGuid = uint64_t(66);
timelineDecoder.CreateRelationship(relationship69);
- ITimelineDecoder::Relationship relationship70;
+ arm::pipe::ITimelineDecoder::Relationship relationship70;
relationship70.m_Guid = uint64_t(70);
- relationship70.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship70.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship70.m_HeadGuid = uint64_t(22);
relationship70.m_TailGuid = uint64_t(66);
timelineDecoder.CreateRelationship(relationship70);
- ITimelineDecoder::Event event71;
+ arm::pipe::ITimelineDecoder::Event event71;
event71.m_Guid = uint64_t(71);
event71.m_TimeStamp = uint64_t(96557081156464);
event71.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event71);
- ITimelineDecoder::Relationship relationship72;
+ arm::pipe::ITimelineDecoder::Relationship relationship72;
relationship72.m_Guid = uint64_t(72);
- relationship72.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship72.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship72.m_HeadGuid = uint64_t(66);
relationship72.m_TailGuid = uint64_t(71);
timelineDecoder.CreateRelationship(relationship72);
- ITimelineDecoder::Relationship relationship73;
+ arm::pipe::ITimelineDecoder::Relationship relationship73;
relationship73.m_Guid = uint64_t(73);
- relationship73.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship73.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship73.m_HeadGuid = uint64_t(71);
relationship73.m_TailGuid = uint64_t(17170418158534996719U);
timelineDecoder.CreateRelationship(relationship73);
- ITimelineDecoder::Event event74;
+ arm::pipe::ITimelineDecoder::Event event74;
event74.m_Guid = uint64_t(74);
event74.m_TimeStamp = uint64_t(96557081220825);
event74.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event74);
- ITimelineDecoder::Relationship relationship75;
+ arm::pipe::ITimelineDecoder::Relationship relationship75;
relationship75.m_Guid = uint64_t(75);
- relationship75.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship75.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship75.m_HeadGuid = uint64_t(66);
relationship75.m_TailGuid = uint64_t(74);
timelineDecoder.CreateRelationship(relationship75);
- ITimelineDecoder::Relationship relationship76;
+ arm::pipe::ITimelineDecoder::Relationship relationship76;
relationship76.m_Guid = uint64_t(76);
- relationship76.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship76.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship76.m_HeadGuid = uint64_t(74);
relationship76.m_TailGuid = uint64_t(10812061579584851344U);
timelineDecoder.CreateRelationship(relationship76);
- ITimelineDecoder::Entity entity77;
+ arm::pipe::ITimelineDecoder::Entity entity77;
entity77.m_Guid = uint64_t(77);
timelineDecoder.CreateEntity(entity77);
- ITimelineDecoder::Relationship relationship78;
+ arm::pipe::ITimelineDecoder::Relationship relationship78;
relationship78.m_Guid = uint64_t(78);
- relationship78.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship78.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship78.m_HeadGuid = uint64_t(77);
relationship78.m_TailGuid = uint64_t(10172155312650606003U);
timelineDecoder.CreateRelationship(relationship78);
- ITimelineDecoder::Relationship relationship79;
+ arm::pipe::ITimelineDecoder::Relationship relationship79;
relationship79.m_Guid = uint64_t(79);
- relationship79.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship79.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship79.m_HeadGuid = uint64_t(78);
relationship79.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship79);
- ITimelineDecoder::Relationship relationship80;
+ arm::pipe::ITimelineDecoder::Relationship relationship80;
relationship80.m_Guid = uint64_t(80);
- relationship80.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship80.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship80.m_HeadGuid = uint64_t(48);
relationship80.m_TailGuid = uint64_t(77);
timelineDecoder.CreateRelationship(relationship80);
- ITimelineDecoder::Relationship relationship81;
+ arm::pipe::ITimelineDecoder::Relationship relationship81;
relationship81.m_Guid = uint64_t(81);
- relationship81.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship81.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship81.m_HeadGuid = uint64_t(42);
relationship81.m_TailGuid = uint64_t(77);
timelineDecoder.CreateRelationship(relationship81);
- ITimelineDecoder::Event event82;
+ arm::pipe::ITimelineDecoder::Event event82;
event82.m_Guid = uint64_t(82);
event82.m_TimeStamp = uint64_t(96557081227643);
event82.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event82);
- ITimelineDecoder::Relationship relationship83;
+ arm::pipe::ITimelineDecoder::Relationship relationship83;
relationship83.m_Guid = uint64_t(83);
- relationship83.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship83.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship83.m_HeadGuid = uint64_t(77);
relationship83.m_TailGuid = uint64_t(82);
timelineDecoder.CreateRelationship(relationship83);
- ITimelineDecoder::Relationship relationship84;
+ arm::pipe::ITimelineDecoder::Relationship relationship84;
relationship84.m_Guid = uint64_t(84);
- relationship84.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship84.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship84.m_HeadGuid = uint64_t(82);
relationship84.m_TailGuid = uint64_t(17170418158534996719U);
timelineDecoder.CreateRelationship(relationship84);
- ITimelineDecoder::Event event85;
+ arm::pipe::ITimelineDecoder::Event event85;
event85.m_Guid = uint64_t(85);
event85.m_TimeStamp = uint64_t(96557081240332);
event85.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event85);
- ITimelineDecoder::Relationship relationship86;
+ arm::pipe::ITimelineDecoder::Relationship relationship86;
relationship86.m_Guid = uint64_t(86);
- relationship86.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship86.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship86.m_HeadGuid = uint64_t(77);
relationship86.m_TailGuid = uint64_t(85);
timelineDecoder.CreateRelationship(relationship86);
- ITimelineDecoder::Relationship relationship87;
+ arm::pipe::ITimelineDecoder::Relationship relationship87;
relationship87.m_Guid = uint64_t(87);
- relationship87.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship87.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship87.m_HeadGuid = uint64_t(85);
relationship87.m_TailGuid = uint64_t(10812061579584851344U);
timelineDecoder.CreateRelationship(relationship87);
- ITimelineDecoder::Event event88;
+ arm::pipe::ITimelineDecoder::Event event88;
event88.m_Guid = uint64_t(88);
event88.m_TimeStamp = uint64_t(96557081243146);
event88.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event88);
- ITimelineDecoder::Relationship relationship89;
+ arm::pipe::ITimelineDecoder::Relationship relationship89;
relationship89.m_Guid = uint64_t(89);
- relationship89.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship89.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship89.m_HeadGuid = uint64_t(48);
relationship89.m_TailGuid = uint64_t(88);
timelineDecoder.CreateRelationship(relationship89);
- ITimelineDecoder::Relationship relationship90;
+ arm::pipe::ITimelineDecoder::Relationship relationship90;
relationship90.m_Guid = uint64_t(90);
- relationship90.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship90.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship90.m_HeadGuid = uint64_t(88);
relationship90.m_TailGuid = uint64_t(10812061579584851344U);
timelineDecoder.CreateRelationship(relationship90);
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "GatordMockService.hpp"
#include "MockUtils.hpp"
-#include <Packet.hpp>
-#include "CommandHandlerFunctor.hpp"
+#include <common/include/Packet.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+
#include "SendCounterPacket.hpp"
#include "IPeriodicCounterCapture.hpp"
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "CommandLineProcessor.hpp"
#include "GatordMockService.hpp"
-#include <ConnectionHandler.hpp>
+#include <server/include/basePipeServer/ConnectionHandler.hpp>
#include <string>
#include <signal.h>
static volatile bool run = true;
void exit_capture(int signum)
{
- IgnoreUnused(signum);
+ arm::pipe::IgnoreUnused(signum);
run = false;
}
-bool CreateMockService(std::unique_ptr<armnnProfiling::BasePipeServer> basePipeServer,
+bool CreateMockService(std::unique_ptr<arm::pipe::BasePipeServer> basePipeServer,
std::string commandFile,
bool isEchoEnabled)
{
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)
{
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "GatordMockService.hpp"
-#include <CommandHandlerRegistry.hpp>
-#include <PacketVersionResolver.hpp>
-#include <ProfilingUtils.hpp>
-#include <NetworkSockets.hpp>
-
-#include <armnn/utility/Assert.hpp>
+#include <common/include/Assert.hpp>
+#include <common/include/CommandHandlerRegistry.hpp>
+#include <common/include/CommonProfilingUtils.hpp>
+#include <common/include/PacketVersionResolver.hpp>
+#include <common/include/NetworkSockets.hpp>
#include <cerrno>
-#include <iomanip>
#include <iostream>
#include <string>
-using namespace armnnUtils;
-
namespace armnn
{
unsigned char* data = reinterpret_cast<unsigned char*>(uniqueData.get());
uint32_t offset = 0;
- profiling::WriteUint32(data, offset, period);
+ arm::pipe::WriteUint32(data, offset, period);
offset += 4;
for (std::vector<uint16_t>::iterator it = counters.begin(); it != counters.end(); ++it)
{
- profiling::WriteUint16(data, offset, *it);
+ arm::pipe::WriteUint16(data, offset, *it);
offset += 2;
}
{
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;
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include <CommandHandlerRegistry.hpp>
-#include <Packet.hpp>
-
-#include <atomic>
-#include <string>
-#include <thread>
-
-#include <TimelineDecoder.hpp>
-#include <DirectoryCaptureCommandHandler.hpp>
-#include <TimelineCaptureCommandHandler.hpp>
-#include <TimelineDirectoryCaptureCommandHandler.hpp>
+// local includes
#include "PeriodicCounterCaptureCommandHandler.hpp"
#include "StreamMetadataCommandHandler.hpp"
+#include "StubCommandHandler.hpp"
-#include <BasePipeServer.hpp>
+#include <common/include/CommandHandlerRegistry.hpp>
+#include <common/include/Packet.hpp>
+#include <common/include/PacketVersionResolver.hpp>
-#include "PacketVersionResolver.hpp"
-#include "StubCommandHandler.hpp"
+#include <server/include/basePipeServer/BasePipeServer.hpp>
+
+#include <server/include/timelineDecoder/TimelineDecoder.hpp>
+#include <server/include/timelineDecoder/TimelineCaptureCommandHandler.hpp>
+#include <server/include/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp>
+
+// src/profiling
+#include <DirectoryCaptureCommandHandler.hpp>
+
+#include <atomic>
+#include <string>
+#include <thread>
namespace armnn
{
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<armnnProfiling::BasePipeServer> clientConnection, bool echoPackets)
+ GatordMockService(std::unique_ptr<arm::pipe::BasePipeServer> clientConnection, bool echoPackets)
: m_BasePipeServer(std::move(clientConnection))
, m_EchoPackets(echoPackets)
, m_CloseReceivingThread(false)
return m_DirectoryCaptureCommandHandler;
}
- timelinedecoder::TimelineDecoder& GetTimelineDecoder()
+ arm::pipe::TimelineDecoder& GetTimelineDecoder()
{
return m_TimelineDecoder;
}
- timelinedecoder::TimelineDirectoryCaptureCommandHandler& GetTimelineDirectoryCaptureCommandHandler()
+ arm::pipe::TimelineDirectoryCaptureCommandHandler& GetTimelineDirectoryCaptureCommandHandler()
{
return m_TimelineDirectoryCaptureCommandHandler;
}
private:
void ReceiveLoop();
- std::unique_ptr<armnnProfiling::BasePipeServer> m_BasePipeServer;
+ std::unique_ptr<arm::pipe::BasePipeServer> m_BasePipeServer;
std::atomic<uint32_t> m_PacketsReceivedCount;
std::thread m_ListeningThread;
std::atomic<bool> 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;
profiling::DirectoryCaptureCommandHandler m_DirectoryCaptureCommandHandler;
- timelinedecoder::TimelineCaptureCommandHandler m_TimelineCaptureCommandHandler;
- timelinedecoder::TimelineDirectoryCaptureCommandHandler m_TimelineDirectoryCaptureCommandHandler;
+ arm::pipe::TimelineCaptureCommandHandler m_TimelineCaptureCommandHandler;
+ arm::pipe::TimelineDirectoryCaptureCommandHandler m_TimelineDirectoryCaptureCommandHandler;
};
} // namespace gatordmock
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "PeriodicCounterCaptureCommandHandler.hpp"
-#include <ProfilingUtils.hpp>
+#include <common/include/CommonProfilingUtils.hpp>
-#include <boost/numeric/conversion/cast.hpp>
+#include <armnn/utility/NumericCast.hpp>
#include <iostream>
namespace gatordmock
{
-using boost::numeric_cast;
-
-void PeriodicCounterCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
+void PeriodicCounterCaptureCommandHandler::ParseData(const arm::pipe::Packet& packet)
{
std::vector<uint16_t> counterIds;
std::vector<uint32_t> counterValues;
- uint32_t sizeOfUint64 = numeric_cast<uint32_t>(sizeof(uint64_t));
- uint32_t sizeOfUint32 = numeric_cast<uint32_t>(sizeof(uint32_t));
- uint32_t sizeOfUint16 = numeric_cast<uint32_t>(sizeof(uint16_t));
+ uint32_t sizeOfUint64 = armnn::numeric_cast<uint32_t>(sizeof(uint64_t));
+ uint32_t sizeOfUint32 = armnn::numeric_cast<uint32_t>(sizeof(uint32_t));
+ uint32_t sizeOfUint16 = armnn::numeric_cast<uint32_t>(sizeof(uint16_t));
uint32_t offset = 0;
{
offset = 0;
- uint64_t timestamp = profiling::ReadUint64(reinterpret_cast<const unsigned char*>(packet.GetData()), offset);
+ uint64_t timestamp = arm::pipe::ReadUint64(reinterpret_cast<const unsigned char*>(packet.GetData()), offset);
if (m_FirstTimestamp == 0) // detect the first timestamp we receive.
{
for (unsigned int pos = 0; pos < counters; ++pos)
{
counterIds.emplace_back(
- profiling::ReadUint16(reinterpret_cast<const unsigned char*>(packet.GetData()), offset));
+ arm::pipe::ReadUint16(reinterpret_cast<const unsigned char*>(packet.GetData()), offset));
offset += sizeOfUint16;
counterValues.emplace_back(
- profiling::ReadUint32(reinterpret_cast<const unsigned char*>(packet.GetData()), offset));
+ arm::pipe::ReadUint32(reinterpret_cast<const unsigned char*>(packet.GetData()), offset));
offset += sizeOfUint32;
}
}
}
}
-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?
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<int>(uidString.size())));
+ header.append(arm::pipe::CentreAlignFormatting("UID's", static_cast<int>(uidString.size())));
header.append(" | ");
- header.append(profiling::CentreAlignFormatting("Values", 10));
+ header.append(arm::pipe::CentreAlignFormatting("Values", 10));
header.append("\n");
std::cout << header;
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include <Packet.hpp>
-#include <CommandHandlerFunctor.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
#include <vector>
std::vector<uint32_t> m_Values;
};
-class PeriodicCounterCaptureCommandHandler : public profiling::CommandHandlerFunctor
+class PeriodicCounterCaptureCommandHandler : public arm::pipe::CommandHandlerFunctor
{
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;
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "PeriodicCounterSelectionResponseHandler.hpp"
-#include <ProfilingUtils.hpp>
+#include <common/include/CommonProfilingUtils.hpp>
#include <iostream>
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<const unsigned char*>(packet.GetData()), 0);
+ uint32_t period = arm::pipe::ReadUint32(reinterpret_cast<const unsigned char*>(packet.GetData()), 0);
uint32_t numCounters = 0;
// First check if there are any counters mentioned.
if(packet.GetLength() > 4)
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include <CommandHandlerFunctor.hpp>
-#include <Packet.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
#include <vector>
namespace gatordmock
{
-class PeriodicCounterSelectionResponseHandler : public profiling::CommandHandlerFunctor
+class PeriodicCounterSelectionResponseHandler : public arm::pipe::CommandHandlerFunctor
{
public:
, m_QuietOperation(quietOperation)
{}
- void operator()(const armnn::profiling::Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
bool m_QuietOperation;
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "StreamMetadataCommandHandler.hpp"
-#include <ProfilingUtils.hpp>
+#include <common/include/CommonProfilingUtils.hpp>
#include <iostream>
-
-using namespace armnn::profiling;
+#include <sstream>
namespace armnn
{
namespace gatordmock
{
-void StreamMetadataCommandHandler::operator()(const Packet& packet)
+void StreamMetadataCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ParseData(packet);
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)
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
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 });
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include <Packet.hpp>
-#include <CommandHandlerFunctor.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
#include <vector>
uint32_t m_PacketVersion;
};
-class StreamMetadataCommandHandler : public profiling::CommandHandlerFunctor
+class StreamMetadataCommandHandler : public arm::pipe::CommandHandlerFunctor
{
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;
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include <CommandHandlerFunctor.hpp>
-#include <armnn/utility/IgnoreUnused.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/IgnoreUnused.hpp>
#include <vector>
namespace gatordmock
{
-class StubCommandHandler : public profiling::CommandHandlerFunctor
+class StubCommandHandler : public arm::pipe::CommandHandlerFunctor
{
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);
}
};
// SPDX-License-Identifier: MIT
//
-#include <CommandHandlerRegistry.hpp>
-#include <ConnectionHandler.hpp>
+#include <common/include/CommandHandlerRegistry.hpp>
+#include <server/include/basePipeServer/ConnectionHandler.hpp>
#include <DirectoryCaptureCommandHandler.hpp>
#include <GatordMockService.hpp>
#include <LabelsAndEventClasses.hpp>
#include <ProfilingService.hpp>
#include <TimelinePacketWriterFactory.hpp>
-#include <TimelineDirectoryCaptureCommandHandler.hpp>
-#include <TimelineDecoder.hpp>
+#include <server/include/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp>
+#include <server/include/timelineDecoder/TimelineDecoder.hpp>
#include <Runtime.hpp>
{
using boost::numeric_cast;
- profiling::PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
// Data with timestamp, counter idx & counter values
std::vector<std::pair<uint16_t, uint32_t>> indexValuePairs;
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);
}
}
-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);
sendTimelinePacket->SendTimelineMessageDirectoryPackage();
sendTimelinePacket->Commit();
- std::vector<profiling::SwTraceMessage> swTraceBufferMessages;
+ std::vector<arm::pipe::SwTraceMessage> swTraceBufferMessages;
unsigned int offset = uint32_t_size * 2;
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);
}
}
-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);
// 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;
// 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();
// 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;
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");
--- /dev/null
+// Formatting library for C++
+//
+// Copyright (c) 2012 - 2016, Victor Zverovich
+// All rights reserved.
+//
+// For the license information refer to format.h.
+
+#include "fmt/format-inl.h"
+
+FMT_BEGIN_NAMESPACE
+namespace detail {
+
+template <typename T>
+int format_float(char* buf, std::size_t size, const char* format, int precision,
+ T value) {
+#ifdef FMT_FUZZ
+ if (precision > 100000)
+ throw std::runtime_error(
+ "fuzz mode - avoid large allocation inside snprintf");
+#endif
+ // Suppress the warning about nonliteral format string.
+ int (*snprintf_ptr)(char*, size_t, const char*, ...) = FMT_SNPRINTF;
+ return precision < 0 ? snprintf_ptr(buf, size, format, value)
+ : snprintf_ptr(buf, size, format, precision, value);
+}
+} // namespace detail
+
+template struct FMT_INSTANTIATION_DEF_API detail::basic_data<void>;
+
+// Workaround a bug in MSVC2013 that prevents instantiation of format_float.
+int (*instantiate_format_float)(double, int, detail::float_specs,
+ detail::buffer<char>&) = detail::format_float;
+
+#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
+template FMT_API detail::locale_ref::locale_ref(const std::locale& loc);
+template FMT_API std::locale detail::locale_ref::get<std::locale>() const;
+#endif
+
+// Explicit instantiations for char.
+
+template FMT_API std::string detail::grouping_impl<char>(locale_ref);
+template FMT_API char detail::thousands_sep_impl(locale_ref);
+template FMT_API char detail::decimal_point_impl(locale_ref);
+
+template FMT_API void detail::buffer<char>::append(const char*, const char*);
+
+template FMT_API FMT_BUFFER_CONTEXT(char)::iterator detail::vformat_to(
+ detail::buffer<char>&, string_view,
+ basic_format_args<FMT_BUFFER_CONTEXT(char)>);
+
+template FMT_API int detail::snprintf_float(double, int, detail::float_specs,
+ detail::buffer<char>&);
+template FMT_API int detail::snprintf_float(long double, int,
+ detail::float_specs,
+ detail::buffer<char>&);
+template FMT_API int detail::format_float(double, int, detail::float_specs,
+ detail::buffer<char>&);
+template FMT_API int detail::format_float(long double, int, detail::float_specs,
+ detail::buffer<char>&);
+
+// Explicit instantiations for wchar_t.
+
+template FMT_API std::string detail::grouping_impl<wchar_t>(locale_ref);
+template FMT_API wchar_t detail::thousands_sep_impl(locale_ref);
+template FMT_API wchar_t detail::decimal_point_impl(locale_ref);
+
+template FMT_API void detail::buffer<wchar_t>::append(const wchar_t*,
+ const wchar_t*);
+FMT_END_NAMESPACE