From 5ccb33da0565e0bf2279318f1e7ad597afcc0367 Mon Sep 17 00:00:00 2001 From: Colm Donelan Date: Fri, 24 Jan 2020 16:27:02 +0000 Subject: IVGCVSW-4316 Promote ISendTimelinePacket and IProfilingGuidGenerator As part of IVGCVSW-4316 we need to expose ISendTimelinePacket and IProfilingGuidGenerator to enable them to be used by backends for profiling. This also required moving ProfilingRelationshipType from ProfilingUtils. Signed-off-by: Colm Donelan Change-Id: I58cc64e32ecfffa5231c9d2028522ed58d0ddf31 --- .../armnn/profiling/IProfilingGuidGenerator.hpp | 32 ++++++++++++ include/armnn/profiling/ISendTimelinePacket.hpp | 61 ++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 include/armnn/profiling/IProfilingGuidGenerator.hpp create mode 100644 include/armnn/profiling/ISendTimelinePacket.hpp (limited to 'include/armnn') diff --git a/include/armnn/profiling/IProfilingGuidGenerator.hpp b/include/armnn/profiling/IProfilingGuidGenerator.hpp new file mode 100644 index 0000000000..fb9f7401fb --- /dev/null +++ b/include/armnn/profiling/IProfilingGuidGenerator.hpp @@ -0,0 +1,32 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include + +#include + +namespace armnn +{ + +namespace profiling +{ + +class IProfilingGuidGenerator +{ +public: + /// Return the next random Guid in the sequence + virtual ProfilingDynamicGuid NextGuid() = 0; + + /// Create a ProfilingStaticGuid based on a hash of the string + virtual ProfilingStaticGuid GenerateStaticId(const std::string& str) = 0; + + virtual ~IProfilingGuidGenerator() {} +}; + +} // namespace profiling + +} // namespace armnn diff --git a/include/armnn/profiling/ISendTimelinePacket.hpp b/include/armnn/profiling/ISendTimelinePacket.hpp new file mode 100644 index 0000000000..49a9fcf40e --- /dev/null +++ b/include/armnn/profiling/ISendTimelinePacket.hpp @@ -0,0 +1,61 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include +#include +#include +#include + +namespace armnn +{ + +namespace profiling +{ + +enum class ProfilingRelationshipType +{ + RetentionLink, /// Head retains(parents) Tail + ExecutionLink, /// Head execution start depends on Tail execution completion + DataLink, /// Head uses data of Tail + LabelLink /// Head uses label Tail (Tail MUST be a guid of a label). +}; + +class ISendTimelinePacket +{ +public: + virtual ~ISendTimelinePacket() + {} + + /// Commits the current buffer and reset the member variables + virtual void Commit() = 0; + + /// Create and write a TimelineEntityBinaryPacket from the parameters to the buffer. + virtual void SendTimelineEntityBinaryPacket(uint64_t profilingGuid) = 0; + + /// Create and write a TimelineEventBinaryPacket from the parameters to the buffer. + virtual void + SendTimelineEventBinaryPacket(uint64_t timestamp, std::thread::id threadId, uint64_t profilingGuid) = 0; + + /// Create and write a TimelineEventClassBinaryPacket from the parameters to the buffer. + virtual void SendTimelineEventClassBinaryPacket(uint64_t profilingGuid) = 0; + + /// Create and write a TimelineLabelBinaryPacket from the parameters to the buffer. + virtual void SendTimelineLabelBinaryPacket(uint64_t profilingGuid, const std::string& label) = 0; + + /// Create and write a TimelineMessageDirectoryPackage in the buffer + virtual void SendTimelineMessageDirectoryPackage() = 0; + + /// Create and write a TimelineRelationshipBinaryPacket from the parameters to the buffer. + virtual void SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType relationshipType, + uint64_t relationshipGuid, + uint64_t headGuid, + uint64_t tailGuid) = 0; +}; + +} // namespace profiling + +} // namespace armnn -- cgit v1.2.1