aboutsummaryrefslogtreecommitdiff
path: root/profiling
diff options
context:
space:
mode:
authorNikhil Raj <nikhil.raj@arm.com>2021-04-30 15:44:24 +0100
committerNikhil Raj <nikhil.raj@arm.com>2021-06-01 22:14:24 +0100
commit7dcc6971722fe3780ca81c51695905e864a6637d (patch)
tree113696974bcbd3a0a4e6df73ea0470c47eca1294 /profiling
parentb8942bf1a49b8ec710fafd7915dd9c8fee62230d (diff)
downloadarmnn-7dcc6971722fe3780ca81c51695905e864a6637d.tar.gz
IVGCVSW-5833 Move the ProfilingGuid out of Types.hpp to its own header in profiling common
!android-nn-driver:5691 Signed-off-by: Nikhil Raj <nikhil.raj@arm.com> Change-Id: Ib71af0831e324ac6bd27b1a36f4a6ec1a703b14a
Diffstat (limited to 'profiling')
-rw-r--r--profiling/common/include/CommandHandlerFunctor.hpp2
-rw-r--r--profiling/common/include/ProfilingGuid.hpp113
2 files changed, 114 insertions, 1 deletions
diff --git a/profiling/common/include/CommandHandlerFunctor.hpp b/profiling/common/include/CommandHandlerFunctor.hpp
index 9827aa05ba..7e31a709a6 100644
--- a/profiling/common/include/CommandHandlerFunctor.hpp
+++ b/profiling/common/include/CommandHandlerFunctor.hpp
@@ -5,7 +5,7 @@
#pragma once
-#include <Packet.hpp>
+#include "Packet.hpp"
#include <cstdint>
namespace arm
diff --git a/profiling/common/include/ProfilingGuid.hpp b/profiling/common/include/ProfilingGuid.hpp
new file mode 100644
index 0000000000..4d0dd9b3c9
--- /dev/null
+++ b/profiling/common/include/ProfilingGuid.hpp
@@ -0,0 +1,113 @@
+//
+// Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <memory>
+#include <stdint.h>
+
+namespace armnn
+{
+
+namespace profiling
+{
+
+static constexpr uint64_t MIN_STATIC_GUID = 1llu << 63;
+
+class ProfilingGuid
+{
+public:
+ ProfilingGuid() : m_Guid(0) {}
+
+ ProfilingGuid(uint64_t guid) : m_Guid(guid) {}
+
+ operator uint64_t() const { return m_Guid; }
+
+ bool operator==(const ProfilingGuid& other) const
+ {
+ return m_Guid == other.m_Guid;
+ }
+
+ bool operator!=(const ProfilingGuid& other) const
+ {
+ return m_Guid != other.m_Guid;
+ }
+
+ bool operator<(const ProfilingGuid& other) const
+ {
+ return m_Guid < other.m_Guid;
+ }
+
+ bool operator<=(const ProfilingGuid& other) const
+ {
+ return m_Guid <= other.m_Guid;
+ }
+
+ bool operator>(const ProfilingGuid& other) const
+ {
+ return m_Guid > other.m_Guid;
+ }
+
+ bool operator>=(const ProfilingGuid& other) const
+ {
+ return m_Guid >= other.m_Guid;
+ }
+
+ protected:
+ uint64_t m_Guid;
+};
+
+/// Strongly typed guids to distinguish between those generated at runtime, and those that are statically defined.
+struct ProfilingDynamicGuid : public ProfilingGuid
+{
+ using ProfilingGuid::ProfilingGuid;
+};
+
+struct ProfilingStaticGuid : public ProfilingGuid
+{
+ using ProfilingGuid::ProfilingGuid;
+};
+
+} // namespace profiling
+
+
+
+} // namespace armnn
+
+
+
+namespace std
+{
+/// make ProfilingGuid hashable
+template <>
+struct hash<armnn::profiling::ProfilingGuid>
+{
+ std::size_t operator()(armnn::profiling::ProfilingGuid const& guid) const noexcept
+ {
+ return hash<uint64_t>()(uint64_t(guid));
+ }
+};
+
+/// make ProfilingDynamicGuid hashable
+template <>
+struct hash<armnn::profiling::ProfilingDynamicGuid>
+{
+ std::size_t operator()(armnn::profiling::ProfilingDynamicGuid const& guid) const noexcept
+ {
+ return hash<uint64_t>()(uint64_t(guid));
+ }
+};
+
+/// make ProfilingStaticGuid hashable
+template <>
+struct hash<armnn::profiling::ProfilingStaticGuid>
+{
+ std::size_t operator()(armnn::profiling::ProfilingStaticGuid const& guid) const noexcept
+ {
+ return hash<uint64_t>()(uint64_t(guid));
+ }
+};
+
+} // namespace std \ No newline at end of file