aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/ProfilingUtils.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/profiling/ProfilingUtils.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/profiling/ProfilingUtils.cpp')
-rw-r--r--src/profiling/ProfilingUtils.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/profiling/ProfilingUtils.cpp b/src/profiling/ProfilingUtils.cpp
index 6d2565c610..4e5fcf8e1a 100644
--- a/src/profiling/ProfilingUtils.cpp
+++ b/src/profiling/ProfilingUtils.cpp
@@ -640,7 +640,6 @@ TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
unsigned int uint8_t_size = sizeof(uint8_t);
unsigned int uint32_t_size = sizeof(uint32_t);
unsigned int uint64_t_size = sizeof(uint64_t);
- unsigned int threadId_size = sizeof(std::thread::id);
// The payload/data of the packet consists of swtrace event definitions encoded according
// to the swtrace directory specification. The messages being the five defined below:
@@ -719,7 +718,7 @@ TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
// Write the stream header
uint8_t streamVersion = 4;
uint8_t pointerBytes = boost::numeric_cast<uint8_t>(uint64_t_size); // All GUIDs are uint64_t
- uint8_t threadIdBytes = boost::numeric_cast<uint8_t>(threadId_size);
+ uint8_t threadIdBytes = boost::numeric_cast<uint8_t>(ThreadIdSize);
switch (threadIdBytes)
{
case 4: // Typically Windows and Android
@@ -813,7 +812,6 @@ TimelinePacketStatus WriteTimelineEventBinary(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);
// decl_id of the timeline message
uint32_t declId = 4;
@@ -821,7 +819,7 @@ TimelinePacketStatus WriteTimelineEventBinary(uint64_t timestamp,
// Calculate the length of the data (in bytes)
unsigned int timelineEventDataLength = uint32_t_size + // decl_id
uint64_t_size + // Timestamp
- threadId_size + // Thread id
+ ThreadIdSize + // Thread id
uint64_t_size; // Profiling GUID
// Check whether the timeline binary packet fits in the given buffer
@@ -838,8 +836,8 @@ TimelinePacketStatus WriteTimelineEventBinary(uint64_t timestamp,
offset += uint32_t_size;
WriteUint64(buffer, offset, timestamp); // Timestamp
offset += uint64_t_size;
- WriteBytes(buffer, offset, &threadId, threadId_size); // Thread id
- offset += threadId_size;
+ WriteBytes(buffer, offset, &threadId, ThreadIdSize); // Thread id
+ offset += ThreadIdSize;
WriteUint64(buffer, offset, profilingGuid); // Profiling GUID
offset += uint64_t_size;
// Update the number of bytes written