diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-11-04 14:05:28 +0000 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-11-05 15:34:21 +0000 |
commit | 378bbfc0d7e97f7e63dc7e39117751a5ac3f21fe (patch) | |
tree | 84567dc58b1c7776adce48008db0f27a3420c0c5 /src/profiling/ProfilingUtils.hpp | |
parent | 2ffcc4179648bbd6fb08342969391a2bcd027221 (diff) | |
download | armnn-378bbfc0d7e97f7e63dc7e39117751a5ac3f21fe.tar.gz |
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 <matteo.martincigh@arm.com>
Change-Id: I1aaa3bdb740c8a97010f655b1e9f7581b52e7aff
Diffstat (limited to 'src/profiling/ProfilingUtils.hpp')
-rw-r--r-- | src/profiling/ProfilingUtils.hpp | 18 |
1 files changed, 17 insertions, 1 deletions
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 <memory> #include <string> #include <vector> +#include <thread> namespace armnn { @@ -92,18 +93,24 @@ uint16_t GetNextUid(bool peekOnly = false); std::vector<uint16_t> 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<uint8_t>& left, std::thread::id right); + +} // namespace std |