From 1a0f691a24b1514afe4d3ea6e1322357083af526 Mon Sep 17 00:00:00 2001 From: Aron Virginas-Tar Date: Fri, 23 Aug 2019 15:18:44 +0100 Subject: [PATCH] IVGCVSW-3441 Create IProfilingConnection and ProfilingConnectionFactory Signed-off-by: Aron Virginas-Tar Change-Id: I912312f31d4fd82b23bafe8e3ec461b179f3e97a --- CMakeLists.txt | 3 +++ include/armnn/IRuntime.hpp | 17 +++++++++++++++ src/profiling/IProfilingConnection.hpp | 32 ++++++++++++++++++++++++++++ src/profiling/ProfilingConnectionFactory.cpp | 22 +++++++++++++++++++ src/profiling/ProfilingConnectionFactory.hpp | 32 ++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 src/profiling/IProfilingConnection.hpp create mode 100644 src/profiling/ProfilingConnectionFactory.cpp create mode 100644 src/profiling/ProfilingConnectionFactory.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d587a7..8f08bf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -420,10 +420,13 @@ list(APPEND armnn_sources src/profiling/CounterDirectory.cpp src/profiling/CounterDirectory.hpp src/profiling/EncodeVersion.hpp + src/profiling/IProfilingConnection.hpp src/profiling/Packet.cpp src/profiling/Packet.hpp src/profiling/PacketVersionResolver.cpp src/profiling/PacketVersionResolver.hpp + src/profiling/ProfilingConnectionFactory.cpp + src/profiling/ProfilingConnectionFactory.hpp third-party/half/half.hpp ) diff --git a/include/armnn/IRuntime.hpp b/include/armnn/IRuntime.hpp index 3f3c998..41e1c47 100644 --- a/include/armnn/IRuntime.hpp +++ b/include/armnn/IRuntime.hpp @@ -44,6 +44,23 @@ public: // Setting this value will override the paths set by the DYNAMIC_BACKEND_PATHS compiler directive // Only a single path is allowed for the override std::string m_DynamicBackendsPath; + + struct ExternalProfilingOptions + { + ExternalProfilingOptions() + : m_EnableProfiling(false) + , m_OutgoingCaptureFile("") + , m_IncomingCaptureFile("") + , m_FileOnly(false) + , m_CapturePeriod(150u) + {} + + bool m_EnableProfiling; + std::string m_OutgoingCaptureFile; + std::string m_IncomingCaptureFile; + bool m_FileOnly; + uint32_t m_CapturePeriod; + }; }; static IRuntime* CreateRaw(const CreationOptions& options); diff --git a/src/profiling/IProfilingConnection.hpp b/src/profiling/IProfilingConnection.hpp new file mode 100644 index 0000000..c8387f2 --- /dev/null +++ b/src/profiling/IProfilingConnection.hpp @@ -0,0 +1,32 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include "Packet.hpp" + +#include + +namespace armnn +{ + +namespace profiling +{ + +class IProfilingConnection +{ +public: + virtual bool IsOpen() = 0; + + virtual void Close() = 0; + + virtual bool WritePacket(const char* buffer, uint32_t length) = 0; + + virtual Packet ReadPacket(uint32_t timeout) = 0; +}; + +} // namespace profiling + +} // namespace armnn diff --git a/src/profiling/ProfilingConnectionFactory.cpp b/src/profiling/ProfilingConnectionFactory.cpp new file mode 100644 index 0000000..1b4924d --- /dev/null +++ b/src/profiling/ProfilingConnectionFactory.cpp @@ -0,0 +1,22 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "ProfilingConnectionFactory.hpp" + +namespace armnn +{ + +namespace profiling +{ + +std::unique_ptr ProfilingConnectionFactory::GetProfilingConnection( + const Runtime::CreationOptions::ExternalProfilingOptions& options) const +{ + return nullptr; +} + +} // namespace profiling + +} // namespace armnn diff --git a/src/profiling/ProfilingConnectionFactory.hpp b/src/profiling/ProfilingConnectionFactory.hpp new file mode 100644 index 0000000..102c820 --- /dev/null +++ b/src/profiling/ProfilingConnectionFactory.hpp @@ -0,0 +1,32 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include "IProfilingConnection.hpp" + +#include + +#include + +namespace armnn +{ + +namespace profiling +{ + +class ProfilingConnectionFactory final +{ +public: + ProfilingConnectionFactory() = default; + ~ProfilingConnectionFactory() = default; + + std::unique_ptr GetProfilingConnection( + const Runtime::CreationOptions::ExternalProfilingOptions& options) const; +}; + +} // namespace profiling + +} // namespace armnn -- 2.7.4