From 15effd8806e77c226b55e546bb44110177383fab Mon Sep 17 00:00:00 2001 From: Narumol Prangnawarat Date: Tue, 22 Oct 2019 14:17:11 +0100 Subject: IVGCVSW-3980 Add ProfilingGuid and ProfilingGuidGenerator API * ProfilingGuid * ProfilingDynamicGuid * ProfilingStaticGuid * ProfilingGuidGenerator API * Unit tests Signed-off-by: Narumol Prangnawarat Change-Id: If950415f059d07d34cf64e13a9b4663dd032ec34 --- src/profiling/ProfilingGuid.hpp | 70 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/profiling/ProfilingGuid.hpp (limited to 'src/profiling/ProfilingGuid.hpp') diff --git a/src/profiling/ProfilingGuid.hpp b/src/profiling/ProfilingGuid.hpp new file mode 100644 index 0000000000..84d2db7363 --- /dev/null +++ b/src/profiling/ProfilingGuid.hpp @@ -0,0 +1,70 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include + +namespace armnn +{ + +namespace profiling +{ + +class ProfilingGuid +{ +public: + 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 !(*this == other); + } + + 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 -- cgit v1.2.1