aboutsummaryrefslogtreecommitdiff
path: root/src/timelineDecoder/tests/TimelineTests.cpp
diff options
context:
space:
mode:
authorColm Donelan <Colm.Donelan@arm.com>2020-05-12 16:36:46 +0100
committerJim Flynn <jim.flynn@arm.com>2020-05-13 06:57:07 +0000
commit5bb3d8a1edeab3f4fdbeb9baf7922cc52bd815fb (patch)
treedde9b2ebeeccb81e089d1f4281dfbc3092bd626b /src/timelineDecoder/tests/TimelineTests.cpp
parent0c8cb99db6dd8b1ea073ef7227b2872a3cb0b269 (diff)
downloadarmnn-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/timelineDecoder/tests/TimelineTests.cpp')
-rw-r--r--src/timelineDecoder/tests/TimelineTests.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/timelineDecoder/tests/TimelineTests.cpp b/src/timelineDecoder/tests/TimelineTests.cpp
index 1f55515758..bff25367fd 100644
--- a/src/timelineDecoder/tests/TimelineTests.cpp
+++ b/src/timelineDecoder/tests/TimelineTests.cpp
@@ -73,7 +73,6 @@ BOOST_AUTO_TEST_CASE(TimelineDirectoryTest)
uint32_t uint8_t_size = sizeof(uint8_t);
uint32_t uint32_t_size = sizeof(uint32_t);
uint32_t uint64_t_size = sizeof(uint64_t);
- uint32_t threadId_size = sizeof(std::thread::id);
profiling::BufferManager bufferManager(5);
profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
@@ -107,7 +106,7 @@ BOOST_AUTO_TEST_CASE(TimelineDirectoryTest)
BOOST_CHECK(readPointerBytes == uint64_t_size);
offset += uint8_t_size;
uint8_t readThreadIdBytes = ReadUint8(packetBuffer, offset);
- BOOST_CHECK(readThreadIdBytes == threadId_size);
+ BOOST_CHECK(readThreadIdBytes == armnn::profiling::ThreadIdSize);
offset += uint8_t_size;
uint32_t declarationSize = profiling::ReadUint32(packetBuffer, offset);
@@ -144,7 +143,6 @@ BOOST_AUTO_TEST_CASE(TimelineDirectoryTest)
BOOST_AUTO_TEST_CASE(TimelineCaptureTest)
{
- unsigned int threadIdSize = sizeof(std::thread::id);
profiling::BufferManager bufferManager(50);
profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
@@ -158,7 +156,8 @@ BOOST_AUTO_TEST_CASE(TimelineCaptureTest)
TimelineCaptureCommandHandler timelineCaptureCommandHandler(
- 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder, threadIdSize);
+ 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder,
+ armnn::profiling::ThreadIdSize);
using Status = ITimelineDecoder::TimelineStatus;
BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success);
@@ -175,16 +174,16 @@ BOOST_AUTO_TEST_CASE(TimelineCaptureTest)
const std::thread::id threadId = std::this_thread::get_id();
// need to do a bit of work here to extract the value from threadId
- unsigned char* uCharThreadId = new unsigned char[threadIdSize]();;
+ unsigned char* uCharThreadId = new unsigned char[armnn::profiling::ThreadIdSize]();;
uint64_t uint64ThreadId;
- profiling::WriteBytes(uCharThreadId, 0, &threadId, threadIdSize);
+ profiling::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize);
- if (threadIdSize == 4)
+ if (armnn::profiling::ThreadIdSize == 4)
{
uint64ThreadId = profiling::ReadUint32(uCharThreadId, 0);
}
- else if (threadIdSize == 8)
+ else if (armnn::profiling::ThreadIdSize == 8)
{
uint64ThreadId = profiling::ReadUint64(uCharThreadId, 0);
}
@@ -256,7 +255,6 @@ BOOST_AUTO_TEST_CASE(TimelineCaptureTest)
BOOST_AUTO_TEST_CASE(TimelineCaptureTestMultipleStringsInBuffer)
{
- unsigned int threadIdSize = sizeof(std::thread::id);
profiling::BufferManager bufferManager(50);
profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
@@ -269,7 +267,8 @@ BOOST_AUTO_TEST_CASE(TimelineCaptureTestMultipleStringsInBuffer)
const TimelineDecoder::Model& model = timelineDecoder.GetModel();
TimelineCaptureCommandHandler timelineCaptureCommandHandler(
- 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder, threadIdSize);
+ 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder,
+ armnn::profiling::ThreadIdSize);
using Status = ITimelineDecoder::TimelineStatus;
BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success);
@@ -286,15 +285,16 @@ BOOST_AUTO_TEST_CASE(TimelineCaptureTestMultipleStringsInBuffer)
const std::thread::id threadId = std::this_thread::get_id();
// need to do a bit of work here to extract the value from threadId
- unsigned char* uCharThreadId = new unsigned char[threadIdSize]();;
+ unsigned char* uCharThreadId = new unsigned char[armnn::profiling::ThreadIdSize]();
uint64_t uint64ThreadId;
- profiling::WriteBytes(uCharThreadId, 0, &threadId, threadIdSize);
+ profiling::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize);
- if ( threadIdSize == 4 )
+ if ( armnn::profiling::ThreadIdSize == 4 )
{
uint64ThreadId = profiling::ReadUint32(uCharThreadId, 0);
- } else if ( threadIdSize == 8 )
+ }
+ else if ( armnn::profiling::ThreadIdSize == 8 )
{
uint64ThreadId = profiling::ReadUint64(uCharThreadId, 0);
}