aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorjaneil01 <jan.eilers@arm.com>2019-11-07 09:32:28 +0000
committerjaneil01 <jan.eilers@arm.com>2019-11-07 13:32:47 +0000
commitc4946c7addd65f032951dbf16fb824cdd67fd463 (patch)
tree4cca1b17024d55529cac74b809d08703e2541406 /include
parente63a026bd987e78bdaa5b94c3e53201b62011faa (diff)
downloadarmnn-c4946c7addd65f032951dbf16fb824cdd67fd463.tar.gz
IVGCVSW-4102 Move ProfilingGuid to public interface
* Moved ProfilingGuid to Types.hpp * Refactoring to enable ProfilingGuid Signed-off-by: janeil01 <jan.eilers@arm.com> Change-Id: Ibf77002d74e484f8a63ffd96aa14303c1f0d38ae
Diffstat (limited to 'include')
-rw-r--r--include/armnn/Types.hpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/include/armnn/Types.hpp b/include/armnn/Types.hpp
index 51162e6cf3..b2aa52edb2 100644
--- a/include/armnn/Types.hpp
+++ b/include/armnn/Types.hpp
@@ -7,6 +7,7 @@
#include <array>
#include <functional>
#include <memory>
+#include <stdint.h>
#include "BackendId.hpp"
#include "Exceptions.hpp"
@@ -219,4 +220,96 @@ class ITensorHandle;
/// @param tensorHandle - TensorHandle for the input tensor to the Debug layer
using DebugCallbackFunction = std::function<void(LayerGuid guid, unsigned int slotIndex, ITensorHandle* tensorHandle)>;
+
+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 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));
+ }
+};
+}