From 378bbfc0d7e97f7e63dc7e39117751a5ac3f21fe Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Mon, 4 Nov 2019 14:05:28 +0000 Subject: IVGCVSW-4065 Use platform-specific thread id size in Timeline packets * Using std::thread::id as a general data type for thread id * Added new profiling util functions for reading/writing a thread id to/from a buffer * Fixed code and unit tests accordingly Signed-off-by: Matteo Martincigh Change-Id: I1aaa3bdb740c8a97010f655b1e9f7581b52e7aff --- src/profiling/ProfilingUtils.hpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/profiling/ProfilingUtils.hpp') diff --git a/src/profiling/ProfilingUtils.hpp b/src/profiling/ProfilingUtils.hpp index 78ac43e0b3..3e0a8a2cec 100644 --- a/src/profiling/ProfilingUtils.hpp +++ b/src/profiling/ProfilingUtils.hpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace armnn { @@ -92,18 +93,24 @@ uint16_t GetNextUid(bool peekOnly = false); std::vector GetNextCounterUids(uint16_t cores); +void WriteBytes(const IPacketBuffer& packetBuffer, unsigned int offset, const void* value, unsigned int valueSize); + void WriteUint64(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint64_t value); void WriteUint32(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint32_t value); void WriteUint16(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint16_t value); +void WriteBytes(unsigned char* buffer, unsigned int offset, const void* value, unsigned int valueSize); + void WriteUint64(unsigned char* buffer, unsigned int offset, uint64_t value); void WriteUint32(unsigned char* buffer, unsigned int offset, uint32_t value); void WriteUint16(unsigned char* buffer, unsigned int offset, uint16_t value); +void ReadBytes(const IPacketBufferPtr& packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[]); + uint64_t ReadUint64(const IPacketBufferPtr& packetBuffer, unsigned int offset); uint32_t ReadUint32(const IPacketBufferPtr& packetBuffer, unsigned int offset); @@ -112,6 +119,8 @@ uint16_t ReadUint16(const IPacketBufferPtr& packetBuffer, unsigned int offset); uint8_t ReadUint8(const IPacketBufferPtr& packetBuffer, unsigned int offset); +void ReadBytes(const unsigned char* buffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[]); + uint64_t ReadUint64(unsigned const char* buffer, unsigned int offset); uint32_t ReadUint32(unsigned const char* buffer, unsigned int offset); @@ -176,7 +185,7 @@ TimelinePacketStatus WriteTimelineEventClassBinaryPacket(uint64_t profilingGuid, unsigned int& numberOfBytesWritten); TimelinePacketStatus WriteTimelineEventBinaryPacket(uint64_t timestamp, - uint32_t threadId, + std::thread::id threadId, uint64_t profilingGuid, unsigned char* buffer, unsigned int bufferSize, @@ -190,3 +199,10 @@ class BufferExhaustion : public armnn::Exception } // namespace profiling } // namespace armnn + +namespace std +{ + +bool operator==(const std::vector& left, std::thread::id right); + +} // namespace std -- cgit v1.2.1