MCPcopy Create free account
hub / github.com/ARM-software/armnn / WriteTimelineEntityBinary

Function WriteTimelineEntityBinary

profiling/client/src/ProfilingUtils.cpp:244–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244TimelinePacketStatus WriteTimelineEntityBinary(uint64_t profilingGuid,
245 unsigned char* buffer,
246 unsigned int remainingBufferSize,
247 unsigned int& numberOfBytesWritten)
248{
249 // Initialize the output value
250 numberOfBytesWritten = 0;
251
252 // Check that the given buffer is valid
253 if (buffer == nullptr || remainingBufferSize == 0)
254 {
255 return TimelinePacketStatus::BufferExhaustion;
256 }
257
258 // Utils
259 unsigned int uint32_t_size = sizeof(uint32_t);
260 unsigned int uint64_t_size = sizeof(uint64_t);
261
262 // Calculate the length of the data (in bytes)
263 unsigned int timelineEntityDataLength = uint32_t_size + uint64_t_size; // decl_id + Profiling GUID
264
265 // Check whether the timeline binary packet fits in the given buffer
266 if (timelineEntityDataLength > remainingBufferSize)
267 {
268 return TimelinePacketStatus::BufferExhaustion;
269 }
270
271 // Initialize the offset for writing in the buffer
272 unsigned int offset = 0;
273
274 // Write the decl_Id to the buffer
275 WriteUint32(buffer, offset, 1u);
276 offset += uint32_t_size;
277
278 // Write the timeline binary packet payload to the buffer
279 WriteUint64(buffer, offset, profilingGuid); // Profiling GUID
280
281 // Update the number of bytes written
282 numberOfBytesWritten = timelineEntityDataLength;
283
284 return TimelinePacketStatus::Ok;
285}
286
287TimelinePacketStatus WriteTimelineRelationshipBinary(ProfilingRelationshipType relationshipType,
288 uint64_t relationshipGuid,

Callers 1

Calls 2

WriteUint32Function · 0.70
WriteUint64Function · 0.70

Tested by

no test coverage detected