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/test/SendTimelinePacketTests.cpp | |
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/test/SendTimelinePacketTests.cpp')
-rw-r--r-- | src/profiling/test/SendTimelinePacketTests.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp index 53e52b5b5b..60cda9a657 100644 --- a/src/profiling/test/SendTimelinePacketTests.cpp +++ b/src/profiling/test/SendTimelinePacketTests.cpp @@ -207,6 +207,7 @@ BOOST_AUTO_TEST_CASE(SendTimelinePacketTests1) { unsigned int uint32_t_size = sizeof(uint32_t); unsigned int uint64_t_size = sizeof(uint64_t); + unsigned int threadId_size = sizeof(std::thread::id); MockBufferManager bufferManager(512); TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager); @@ -303,7 +304,7 @@ BOOST_AUTO_TEST_CASE(SendTimelinePacketTests1) // Send TimelineEventBinaryPacket const uint64_t timestamp = 456789u; - const uint32_t threadId = 654321u; + const std::thread::id threadId = std::this_thread::get_id(); const uint64_t eventProfilingGuid = 123456u; sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventProfilingGuid); @@ -333,7 +334,7 @@ BOOST_AUTO_TEST_CASE(SendTimelinePacketTests1) uint32_t eventBinaryPacketSequenceNumbered = (eventBinaryPacketHeaderWord1 >> 24) & 0x00000001; uint32_t eventBinaryPacketDataLength = (eventBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF; BOOST_CHECK(eventBinaryPacketSequenceNumbered == 0); - BOOST_CHECK(eventBinaryPacketDataLength == 24); + BOOST_CHECK(eventBinaryPacketDataLength == 28); // Check the decl_id offset += uint32_t_size; @@ -347,11 +348,12 @@ BOOST_AUTO_TEST_CASE(SendTimelinePacketTests1) // Check the thread id offset += uint64_t_size; - uint32_t readThreadId = ReadUint32(packetBuffer, offset); + std::vector<uint8_t> readThreadId(threadId_size, 0); + ReadBytes(packetBuffer, offset, threadId_size, readThreadId.data()); BOOST_CHECK(readThreadId == threadId); // Check the profiling GUID - offset += uint32_t_size; + offset += threadId_size; readProfilingGuid = ReadUint64(packetBuffer, offset); BOOST_CHECK(readProfilingGuid == eventProfilingGuid); } |