diff options
author | Colm Donelan <Colm.Donelan@arm.com> | 2020-05-12 16:36:46 +0100 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2020-05-13 06:57:07 +0000 |
commit | 5bb3d8a1edeab3f4fdbeb9baf7922cc52bd815fb (patch) | |
tree | dde9b2ebeeccb81e089d1f4281dfbc3092bd626b /src/profiling/test/ProfilingTestUtils.cpp | |
parent | 0c8cb99db6dd8b1ea073ef7227b2872a3cb0b269 (diff) | |
download | armnn-5bb3d8a1edeab3f4fdbeb9baf7922cc52bd815fb.tar.gz |
IVGCVSW-4775 Centralizing definition of ThreadIdSize to fix MLCE-189
* Introduce a constant definition of the size of a POSIX thread ID.
* Update all code to use the new constant definition.
* Update all unit tests to use the new constant definition.
Signed-off-by: Colm Donelan <Colm.Donelan@arm.com>
Change-Id: I836ab1a77ed13f774e66fd7b425923c24b9a6dab
Diffstat (limited to 'src/profiling/test/ProfilingTestUtils.cpp')
-rw-r--r-- | src/profiling/test/ProfilingTestUtils.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp index c1386820e8..73dbf881b3 100644 --- a/src/profiling/test/ProfilingTestUtils.cpp +++ b/src/profiling/test/ProfilingTestUtils.cpp @@ -263,7 +263,6 @@ void VerifyTimelineEventBinaryPacket(Optional<uint64_t> timestamp, // Utils unsigned int uint32_t_size = sizeof(uint32_t); unsigned int uint64_t_size = sizeof(uint64_t); - unsigned int threadId_size = sizeof(std::thread::id); // Reading TimelineEventBinaryPacket // Check the decl_id @@ -284,8 +283,8 @@ void VerifyTimelineEventBinaryPacket(Optional<uint64_t> timestamp, // Check the thread id offset += uint64_t_size; - std::vector<uint8_t> readThreadId(threadId_size, 0); - ReadBytes(readableData, offset, threadId_size, readThreadId.data()); + std::vector<uint8_t> readThreadId(ThreadIdSize, 0); + ReadBytes(readableData, offset, ThreadIdSize, readThreadId.data()); if (threadId.has_value()) { BOOST_CHECK(readThreadId == threadId.value()); @@ -296,7 +295,7 @@ void VerifyTimelineEventBinaryPacket(Optional<uint64_t> timestamp, } // Check the event GUID - offset += threadId_size; + offset += ThreadIdSize; uint64_t readEventGuid = ReadUint64(readableData, offset); if (eventGuid.has_value()) { @@ -936,8 +935,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) // Validate inference data size = inferenceReadableBuffer->GetSize(); - unsigned int threadId_size = sizeof(std::thread::id); // Is platform dependent - BOOST_CHECK(size == 1516 + 10 * threadId_size); + BOOST_CHECK(size == 1516 + 10 * ThreadIdSize); readableData = inferenceReadableBuffer->GetReadableData(); BOOST_CHECK(readableData != nullptr); @@ -945,7 +943,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) offset = 0; // Verify Header - VerifyTimelineHeaderBinary(readableData, offset, 1508 + 10 * threadId_size); + VerifyTimelineHeaderBinary(readableData, offset, 1508 + 10 * ThreadIdSize); // Inference timeline trace // Inference entity |