aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/SendTimelinePacket.hpp
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2019-10-24 10:26:05 +0100
committerJim Flynn Arm <jim.flynn@arm.com>2019-10-24 10:06:40 +0000
commit7bbdf9db051f40377a284a28375816e60349376d (patch)
treedc7d8442cecb2f23ca2f93c8535316ed5207be69 /src/profiling/SendTimelinePacket.hpp
parenta87698211b6aaab38424865d200534d96f55dcf2 (diff)
downloadarmnn-7bbdf9db051f40377a284a28375816e60349376d.tar.gz
IVGCVSW-3950 Create SendTimelinePacket interface and class
* Implemented ISendTimelinePacket interface and its implementation SendTimelinePacket * Implemented TimelinePacketWriterFactory * Implemented unit tests for SendTimelinePacket functions Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: I0a47586437f99510394d4d94589dccfb397d38e5
Diffstat (limited to 'src/profiling/SendTimelinePacket.hpp')
-rw-r--r--src/profiling/SendTimelinePacket.hpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/profiling/SendTimelinePacket.hpp b/src/profiling/SendTimelinePacket.hpp
new file mode 100644
index 0000000000..35ec24ffae
--- /dev/null
+++ b/src/profiling/SendTimelinePacket.hpp
@@ -0,0 +1,65 @@
+//
+// Copyright © 2019 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include "IBufferManager.hpp"
+#include "ISendTimelinePacket.hpp"
+#include "ProfilingUtils.hpp"
+
+#include <memory>
+
+namespace armnn
+{
+
+namespace profiling
+{
+
+class SendTimelinePacket : public ISendTimelinePacket
+{
+public:
+ SendTimelinePacket(IBufferManager& bufferManager)
+ : m_BufferManager(bufferManager)
+ , m_WriteBuffer(nullptr)
+ , m_Offset(0u)
+ , m_BufferSize(0u)
+ {}
+
+ /// Commits the current buffer and reset the member variables
+ void Commit() override;
+
+ /// Create and write a TimelineEntityBinaryPacket from the parameters to the buffer.
+ void SendTimelineEntityBinaryPacket(uint64_t profilingGuid) override;
+
+ /// Create and write a TimelineEventBinaryPacket from the parameters to the buffer.
+ void SendTimelineEventBinaryPacket(uint64_t timestamp, uint32_t threadId, uint64_t profilingGuid) override;
+
+ /// Create and write a TimelineEventClassBinaryPacket from the parameters to the buffer.
+ void SendTimelineEventClassBinaryPacket(uint64_t profilingGuid) override;
+
+ /// Create and write a TimelineLabelBinaryPacket from the parameters to the buffer.
+ void SendTimelineLabelBinaryPacket(uint64_t profilingGuid, const std::string& label) override;
+
+ /// Create and write a TimelineMessageDirectoryPackage in the buffer
+ void SendTimelineMessageDirectoryPackage() override;
+
+ /// 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) override;
+private:
+ /// Reserves maximum packet size from buffer
+ void ReserveBuffer();
+
+ IBufferManager& m_BufferManager;
+ std::unique_ptr<IPacketBuffer> m_WriteBuffer;
+ unsigned int m_Offset;
+ unsigned int m_BufferSize;
+};
+
+} // namespace profiling
+
+} // namespace armnn