ArmNN
 22.02
SendTimelinePacketTests.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "ProfilingMocks.hpp"
7 
8 #include <BufferManager.hpp>
9 #include <ProfilingService.hpp>
10 #include <ProfilingUtils.hpp>
11 #include <SendTimelinePacket.hpp>
12 #include <armnnUtils/Threads.hpp>
14 
15 #include <common/include/SwTrace.hpp>
16 #include <common/include/LabelsAndEventClasses.hpp>
17 
18 #include <doctest/doctest.h>
19 
20 #include <functional>
21 #include <Runtime.hpp>
22 
23 using namespace armnn::profiling;
24 
25 TEST_SUITE("SendTimelinePacketTests")
26 {
27 TEST_CASE("SendTimelineMessageDirectoryPackageTest")
28 {
29  MockBufferManager mockBuffer(512);
30  TimelinePacketWriterFactory timelinePacketWriterFactory(mockBuffer);
31  std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = timelinePacketWriterFactory.GetSendTimelinePacket();
32 
33  sendTimelinePacket->SendTimelineMessageDirectoryPackage();
34 
35  // Get the readable buffer
36  auto packetBuffer = mockBuffer.GetReadableBuffer();
37 
38  unsigned int uint8_t_size = sizeof(uint8_t);
39  unsigned int uint32_t_size = sizeof(uint32_t);
40  unsigned int uint64_t_size = sizeof(uint64_t);
41 
42  // Check the packet header
43  unsigned int offset = 0;
44  uint32_t packetHeaderWord0 = ReadUint32(packetBuffer, offset);
45  uint32_t packetFamily = (packetHeaderWord0 >> 26) & 0x0000003F;
46  uint32_t packetClass = (packetHeaderWord0 >> 19) & 0x0000007F;
47  uint32_t packetType = (packetHeaderWord0 >> 16) & 0x00000007;
48  uint32_t streamId = (packetHeaderWord0 >> 0) & 0x00000007;
49 
50  CHECK(packetFamily == 1);
51  CHECK(packetClass == 0);
52  CHECK(packetType == 0);
53  CHECK(streamId == 0);
54 
55  offset += uint32_t_size;
56  uint32_t packetHeaderWord1 = ReadUint32(packetBuffer, offset);
57  uint32_t sequenceNumbered = (packetHeaderWord1 >> 24) & 0x00000001;
58  uint32_t dataLength = (packetHeaderWord1 >> 0) & 0x00FFFFFF;
59  CHECK(sequenceNumbered == 0);
60  CHECK(dataLength == 443);
61 
62  offset += uint32_t_size;
63  uint8_t readStreamVersion = ReadUint8(packetBuffer, offset);
64  CHECK(readStreamVersion == 4);
65  offset += uint8_t_size;
66  uint8_t readPointerBytes = ReadUint8(packetBuffer, offset);
67  CHECK(readPointerBytes == uint64_t_size);
68  offset += uint8_t_size;
69  uint8_t readThreadIdBytes = ReadUint8(packetBuffer, offset);
70  CHECK(readThreadIdBytes == ThreadIdSize);
71 
72  offset += uint8_t_size;
73  uint32_t DeclCount = ReadUint32(packetBuffer, offset);
74  CHECK(DeclCount == 5);
75 
76  offset += uint32_t_size;
77  arm::pipe::SwTraceMessage swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
78  offset,
79  packetBuffer->GetSize());
80 
81  CHECK(swTraceMessage.m_Id == 0);
82  CHECK(swTraceMessage.m_Name == "declareLabel");
83  CHECK(swTraceMessage.m_UiName == "declare label");
84  CHECK(swTraceMessage.m_ArgTypes.size() == 2);
85  CHECK(swTraceMessage.m_ArgTypes[0] == 'p');
86  CHECK(swTraceMessage.m_ArgTypes[1] == 's');
87  CHECK(swTraceMessage.m_ArgNames.size() == 2);
88  CHECK(swTraceMessage.m_ArgNames[0] == "guid");
89  CHECK(swTraceMessage.m_ArgNames[1] == "value");
90 
91  swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
92  offset,
93  packetBuffer->GetSize());
94 
95  CHECK(swTraceMessage.m_Id == 1);
96  CHECK(swTraceMessage.m_Name == "declareEntity");
97  CHECK(swTraceMessage.m_UiName == "declare entity");
98  CHECK(swTraceMessage.m_ArgTypes.size() == 1);
99  CHECK(swTraceMessage.m_ArgTypes[0] == 'p');
100  CHECK(swTraceMessage.m_ArgNames.size() == 1);
101  CHECK(swTraceMessage.m_ArgNames[0] == "guid");
102 
103  swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
104  offset,
105  packetBuffer->GetSize());
106 
107  CHECK(swTraceMessage.m_Id == 2);
108  CHECK(swTraceMessage.m_Name == "declareEventClass");
109  CHECK(swTraceMessage.m_UiName == "declare event class");
110  CHECK(swTraceMessage.m_ArgTypes.size() == 2);
111  CHECK(swTraceMessage.m_ArgTypes[0] == 'p');
112  CHECK(swTraceMessage.m_ArgTypes[1] == 'p');
113  CHECK(swTraceMessage.m_ArgNames.size() == 2);
114  CHECK(swTraceMessage.m_ArgNames[0] == "guid");
115  CHECK(swTraceMessage.m_ArgNames[1] == "nameGuid");
116 
117  swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
118  offset,
119  packetBuffer->GetSize());
120 
121  CHECK(swTraceMessage.m_Id == 3);
122  CHECK(swTraceMessage.m_Name == "declareRelationship");
123  CHECK(swTraceMessage.m_UiName == "declare relationship");
124  CHECK(swTraceMessage.m_ArgTypes.size() == 5);
125  CHECK(swTraceMessage.m_ArgTypes[0] == 'I');
126  CHECK(swTraceMessage.m_ArgTypes[1] == 'p');
127  CHECK(swTraceMessage.m_ArgTypes[2] == 'p');
128  CHECK(swTraceMessage.m_ArgTypes[3] == 'p');
129  CHECK(swTraceMessage.m_ArgTypes[4] == 'p');
130  CHECK(swTraceMessage.m_ArgNames.size() == 5);
131  CHECK(swTraceMessage.m_ArgNames[0] == "relationshipType");
132  CHECK(swTraceMessage.m_ArgNames[1] == "relationshipGuid");
133  CHECK(swTraceMessage.m_ArgNames[2] == "headGuid");
134  CHECK(swTraceMessage.m_ArgNames[3] == "tailGuid");
135  CHECK(swTraceMessage.m_ArgNames[4] == "attributeGuid");
136 
137  swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
138  offset,
139  packetBuffer->GetSize());
140 
141  CHECK(swTraceMessage.m_Id == 4);
142  CHECK(swTraceMessage.m_Name == "declareEvent");
143  CHECK(swTraceMessage.m_UiName == "declare event");
144  CHECK(swTraceMessage.m_ArgTypes.size() == 3);
145  CHECK(swTraceMessage.m_ArgTypes[0] == '@');
146  CHECK(swTraceMessage.m_ArgTypes[1] == 't');
147  CHECK(swTraceMessage.m_ArgTypes[2] == 'p');
148  CHECK(swTraceMessage.m_ArgNames.size() == 3);
149  CHECK(swTraceMessage.m_ArgNames[0] == "timestamp");
150  CHECK(swTraceMessage.m_ArgNames[1] == "threadId");
151  CHECK(swTraceMessage.m_ArgNames[2] == "eventGuid");
152 }
153 
154 TEST_CASE("SendTimelineEntityWithEventClassPacketTest")
155 {
156  MockBufferManager bufferManager(40);
157  TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
158  std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = timelinePacketWriterFactory.GetSendTimelinePacket();
159 
160  const uint64_t entityBinaryPacketProfilingGuid = 123456u;
161  sendTimelinePacket->SendTimelineEntityBinaryPacket(entityBinaryPacketProfilingGuid);
162 
163  const uint64_t eventClassBinaryPacketProfilingGuid = 789123u;
164  const uint64_t eventClassBinaryPacketNameGuid = 8845u;
165  sendTimelinePacket->SendTimelineEventClassBinaryPacket(
166  eventClassBinaryPacketProfilingGuid, eventClassBinaryPacketNameGuid);
167 
168  // Commit the messages
169  sendTimelinePacket->Commit();
170 
171  // Get the readable buffer
172  auto packetBuffer = bufferManager.GetReadableBuffer();
173 
174  unsigned int uint32_t_size = sizeof(uint32_t);
175  unsigned int uint64_t_size = sizeof(uint64_t);
176 
177  // Check the packet header
178  unsigned int offset = 0;
179 
180  // Reading TimelineEntityClassBinaryPacket
181  uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(packetBuffer, offset);
182  uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
183  uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
184  uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
185  uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
186 
187  CHECK(entityBinaryPacketFamily == 1);
188  CHECK(entityBinaryPacketClass == 0);
189  CHECK(entityBinaryPacketType == 1);
190  CHECK(entityBinaryPacketStreamId == 0);
191 
192  offset += uint32_t_size;
193 
194  uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(packetBuffer, offset);
195 
196  uint32_t entityBinaryPacketSequenceNumbered = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
197  uint32_t entityBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
198 
199  CHECK(entityBinaryPacketSequenceNumbered == 0);
200  CHECK(entityBinaryPacketDataLength == 32);
201 
202  // Check the decl_id
203  offset += uint32_t_size;
204  uint32_t entitytDecId = ReadUint32(packetBuffer, offset);
205 
206  CHECK(entitytDecId == uint32_t(1));
207 
208  // Check the profiling GUID
209  offset += uint32_t_size;
210  uint64_t readProfilingGuid = ReadUint64(packetBuffer, offset);
211 
212  CHECK(readProfilingGuid == entityBinaryPacketProfilingGuid);
213 
214  // Reading TimelineEventClassBinaryPacket
215  offset += uint64_t_size;
216 
217  uint32_t eventClassDeclId = ReadUint32(packetBuffer, offset);
218  CHECK(eventClassDeclId == uint32_t(2));
219 
220  // Check the profiling GUID
221  offset += uint32_t_size;
222  readProfilingGuid = ReadUint64(packetBuffer, offset);
223  CHECK(readProfilingGuid == eventClassBinaryPacketProfilingGuid);
224 
225  offset += uint64_t_size;
226  uint64_t readEventClassNameGuid = ReadUint64(packetBuffer, offset);
227  CHECK(readEventClassNameGuid == eventClassBinaryPacketNameGuid);
228 
229  bufferManager.MarkRead(packetBuffer);
230 }
231 
232 TEST_CASE("SendEventClassAfterTimelineEntityPacketTest")
233 {
234  unsigned int uint32_t_size = sizeof(uint32_t);
235  unsigned int uint64_t_size = sizeof(uint64_t);
236 
237  MockBufferManager bufferManager(512);
238  TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
239  std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = timelinePacketWriterFactory.GetSendTimelinePacket();
240 
241  // Send TimelineEntityClassBinaryPacket
242  const uint64_t entityBinaryPacketProfilingGuid = 123456u;
243  sendTimelinePacket->SendTimelineEntityBinaryPacket(entityBinaryPacketProfilingGuid);
244 
245  // Commit the buffer
246  sendTimelinePacket->Commit();
247 
248  // Get the readable buffer
249  auto packetBuffer = bufferManager.GetReadableBuffer();
250 
251  // Check the packet header
252  unsigned int offset = 0;
253 
254  // Reading TimelineEntityClassBinaryPacket
255  uint32_t entityBinaryPacketHeaderWord0 = ReadUint32(packetBuffer, offset);
256  uint32_t entityBinaryPacketFamily = (entityBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
257  uint32_t entityBinaryPacketClass = (entityBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
258  uint32_t entityBinaryPacketType = (entityBinaryPacketHeaderWord0 >> 16) & 0x00000007;
259  uint32_t entityBinaryPacketStreamId = (entityBinaryPacketHeaderWord0 >> 0) & 0x00000007;
260 
261  CHECK(entityBinaryPacketFamily == 1);
262  CHECK(entityBinaryPacketClass == 0);
263  CHECK(entityBinaryPacketType == 1);
264  CHECK(entityBinaryPacketStreamId == 0);
265 
266  offset += uint32_t_size;
267  uint32_t entityBinaryPacketHeaderWord1 = ReadUint32(packetBuffer, offset);
268  uint32_t entityBinaryPacketSequenceNumbered = (entityBinaryPacketHeaderWord1 >> 24) & 0x00000001;
269  uint32_t entityBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
270  CHECK(entityBinaryPacketSequenceNumbered == 0);
271  CHECK(entityBinaryPacketDataLength == 12);
272 
273  // Check the decl_id
274  offset += uint32_t_size;
275  uint32_t entitytDecId = ReadUint32(packetBuffer, offset);
276 
277  CHECK(entitytDecId == uint32_t(1));
278 
279  // Check the profiling GUID
280  offset += uint32_t_size;
281  uint64_t readProfilingGuid = ReadUint64(packetBuffer, offset);
282 
283  CHECK(readProfilingGuid == entityBinaryPacketProfilingGuid);
284 
285  bufferManager.MarkRead(packetBuffer);
286 
287  // Send TimelineEventClassBinaryPacket
288  const uint64_t eventClassBinaryPacketProfilingGuid = 789123u;
289  const uint64_t eventClassBinaryPacketNameGuid = 8845u;
290  sendTimelinePacket->SendTimelineEventClassBinaryPacket(
291  eventClassBinaryPacketProfilingGuid, eventClassBinaryPacketNameGuid);
292 
293  // Commit the buffer
294  sendTimelinePacket->Commit();
295 
296  // Get the readable buffer
297  packetBuffer = bufferManager.GetReadableBuffer();
298 
299  // Check the packet header
300  offset = 0;
301 
302  // Reading TimelineEventClassBinaryPacket
303  uint32_t eventClassBinaryPacketHeaderWord0 = ReadUint32(packetBuffer, offset);
304  uint32_t eventClassBinaryPacketFamily = (eventClassBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
305  uint32_t eventClassBinaryPacketClass = (eventClassBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
306  uint32_t eventClassBinaryPacketType = (eventClassBinaryPacketHeaderWord0 >> 16) & 0x00000007;
307  uint32_t eventClassBinaryPacketStreamId = (eventClassBinaryPacketHeaderWord0 >> 0) & 0x00000007;
308 
309  CHECK(eventClassBinaryPacketFamily == 1);
310  CHECK(eventClassBinaryPacketClass == 0);
311  CHECK(eventClassBinaryPacketType == 1);
312  CHECK(eventClassBinaryPacketStreamId == 0);
313 
314  offset += uint32_t_size;
315  uint32_t eventClassBinaryPacketHeaderWord1 = ReadUint32(packetBuffer, offset);
316  uint32_t eventClassBinaryPacketSequenceNumbered = (eventClassBinaryPacketHeaderWord1 >> 24) & 0x00000001;
317  uint32_t eventClassBinaryPacketDataLength = (eventClassBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
318  CHECK(eventClassBinaryPacketSequenceNumbered == 0);
319  CHECK(eventClassBinaryPacketDataLength == 20);
320 
321  offset += uint32_t_size;
322  uint32_t eventClassDeclId = ReadUint32(packetBuffer, offset);
323  CHECK(eventClassDeclId == uint32_t(2));
324 
325  // Check the profiling GUID
326  offset += uint32_t_size;
327  readProfilingGuid = ReadUint64(packetBuffer, offset);
328  CHECK(readProfilingGuid == eventClassBinaryPacketProfilingGuid);
329 
330  offset += uint64_t_size;
331  uint64_t readEventClassNameGuid = ReadUint64(packetBuffer, offset);
332  CHECK(readEventClassNameGuid == eventClassBinaryPacketNameGuid);
333 
334  bufferManager.MarkRead(packetBuffer);
335 
336  // Send TimelineEventBinaryPacket
337  const uint64_t timestamp = 456789u;
338  const int threadId = armnnUtils::Threads::GetCurrentThreadId();
339  const uint64_t eventProfilingGuid = 123456u;
340  sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventProfilingGuid);
341 
342  // Commit the buffer
343  sendTimelinePacket->Commit();
344 
345  // Get the readable buffer
346  packetBuffer = bufferManager.GetReadableBuffer();
347 
348  // Check the packet header
349  offset = 0;
350 
351  // Reading TimelineEventBinaryPacket
352  uint32_t eventBinaryPacketHeaderWord0 = ReadUint32(packetBuffer, offset);
353  uint32_t eventBinaryPacketFamily = (eventBinaryPacketHeaderWord0 >> 26) & 0x0000003F;
354  uint32_t eventBinaryPacketClass = (eventBinaryPacketHeaderWord0 >> 19) & 0x0000007F;
355  uint32_t eventBinaryPacketType = (eventBinaryPacketHeaderWord0 >> 16) & 0x00000007;
356  uint32_t eventBinaryPacketStreamId = (eventBinaryPacketHeaderWord0 >> 0) & 0x00000007;
357 
358  CHECK(eventBinaryPacketFamily == 1);
359  CHECK(eventBinaryPacketClass == 0);
360  CHECK(eventBinaryPacketType == 1);
361  CHECK(eventBinaryPacketStreamId == 0);
362 
363  offset += uint32_t_size;
364  uint32_t eventBinaryPacketHeaderWord1 = ReadUint32(packetBuffer, offset);
365  uint32_t eventBinaryPacketSequenceNumbered = (eventBinaryPacketHeaderWord1 >> 24) & 0x00000001;
366  uint32_t eventBinaryPacketDataLength = (eventBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
367  CHECK(eventBinaryPacketSequenceNumbered == 0);
368  CHECK(eventBinaryPacketDataLength == 20 + ThreadIdSize);
369 
370  // Check the decl_id
371  offset += uint32_t_size;
372  uint32_t eventDeclId = ReadUint32(packetBuffer, offset);
373  CHECK(eventDeclId == 4);
374 
375  // Check the timestamp
376  offset += uint32_t_size;
377  uint64_t eventTimestamp = ReadUint64(packetBuffer, offset);
378  CHECK(eventTimestamp == timestamp);
379 
380  // Check the thread id
381  offset += uint64_t_size;
382  std::vector<uint8_t> readThreadId(ThreadIdSize, 0);
383  ReadBytes(packetBuffer, offset, ThreadIdSize, readThreadId.data());
384  CHECK(readThreadId == threadId);
385 
386  // Check the profiling GUID
387  offset += ThreadIdSize;
388  readProfilingGuid = ReadUint64(packetBuffer, offset);
389  CHECK(readProfilingGuid == eventProfilingGuid);
390 }
391 
392 TEST_CASE("SendTimelinePacketTests2")
393 {
394  MockBufferManager bufferManager(40);
395  TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
396  std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = timelinePacketWriterFactory.GetSendTimelinePacket();
397 
398  CHECK_THROWS_AS(sendTimelinePacket->SendTimelineMessageDirectoryPackage(),
400 }
401 
402 TEST_CASE("SendTimelinePacketTests3")
403 {
404  MockBufferManager bufferManager(512);
405  TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
406  std::unique_ptr<ISendTimelinePacket> sendTimelinePacket = timelinePacketWriterFactory.GetSendTimelinePacket();
407 
408  // Send TimelineEntityClassBinaryPacket
409  const uint64_t entityBinaryPacketProfilingGuid = 123456u;
410  sendTimelinePacket->SendTimelineEntityBinaryPacket(entityBinaryPacketProfilingGuid);
411 
412  // Commit the buffer
413  sendTimelinePacket->Commit();
414 
415  // Get the readable buffer
416  auto packetBuffer = bufferManager.GetReadableBuffer();
417 
418  // Send TimelineEventClassBinaryPacket
419  const uint64_t eventClassBinaryPacketProfilingGuid = 789123u;
420  const uint64_t eventClassBinaryPacketNameGuid = 8845u;
421  CHECK_THROWS_AS(sendTimelinePacket->SendTimelineEventClassBinaryPacket(
422  eventClassBinaryPacketProfilingGuid, eventClassBinaryPacketNameGuid),
424 }
425 
426 TEST_CASE("GetGuidsFromProfilingService")
427 {
429  options.m_ProfilingOptions.m_EnableProfiling = true;
430  armnn::RuntimeImpl runtime(options);
431  armnn::profiling::ProfilingService profilingService(runtime);
432 
433  profilingService.ResetExternalProfilingOptions(options.m_ProfilingOptions, true);
434  ProfilingStaticGuid staticGuid = profilingService.GetStaticId("dummy");
435  std::hash<std::string> hasher;
436  uint64_t hash = static_cast<uint64_t>(hasher("dummy"));
437  ProfilingStaticGuid expectedStaticValue(hash | MIN_STATIC_GUID);
438  CHECK(staticGuid == expectedStaticValue);
439  ProfilingDynamicGuid dynamicGuid = profilingService.GetNextGuid();
440  uint64_t dynamicGuidValue = static_cast<uint64_t>(dynamicGuid);
441  ++dynamicGuidValue;
442  ProfilingDynamicGuid expectedDynamicValue(dynamicGuidValue);
443  dynamicGuid = profilingService.GetNextGuid();
444  CHECK(dynamicGuid == expectedDynamicValue);
445 }
446 
447 TEST_CASE("GetTimelinePackerWriterFromProfilingService")
448 {
450  options.m_EnableProfiling = true;
451  armnn::profiling::ProfilingService profilingService;
452  profilingService.ResetExternalProfilingOptions(options, true);
453 
454  std::unique_ptr<ISendTimelinePacket> writer = profilingService.GetSendTimelinePacket();
455  CHECK(writer != nullptr);
456 }
457 
458 TEST_CASE("CheckStaticGuidsAndEvents")
459 {
460  CHECK("name" == LabelsAndEventClasses::NAME_LABEL);
461  CHECK("type" == LabelsAndEventClasses::TYPE_LABEL);
462  CHECK("index" == LabelsAndEventClasses::INDEX_LABEL);
463 
464  std::hash<std::string> hasher;
465 
466  uint64_t hash = static_cast<uint64_t>(hasher(LabelsAndEventClasses::NAME_LABEL));
467  ProfilingStaticGuid expectedNameGuid(hash | MIN_STATIC_GUID);
468  CHECK(LabelsAndEventClasses::NAME_GUID == expectedNameGuid);
469 
470  hash = static_cast<uint64_t>(hasher(LabelsAndEventClasses::TYPE_LABEL));
471  ProfilingStaticGuid expectedTypeGuid(hash | MIN_STATIC_GUID);
472  CHECK(LabelsAndEventClasses::TYPE_GUID == expectedTypeGuid);
473 
474  hash = static_cast<uint64_t>(hasher(LabelsAndEventClasses::INDEX_LABEL));
475  ProfilingStaticGuid expectedIndexGuid(hash | MIN_STATIC_GUID);
476  CHECK(LabelsAndEventClasses::INDEX_GUID == expectedIndexGuid);
477 
478  hash = static_cast<uint64_t>(hasher("ARMNN_PROFILING_SOL"));
479  ProfilingStaticGuid expectedSol(hash | MIN_STATIC_GUID);
480  CHECK(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS == expectedSol);
481 
482  hash = static_cast<uint64_t>(hasher("ARMNN_PROFILING_EOL"));
483  ProfilingStaticGuid expectedEol(hash | MIN_STATIC_GUID);
484  CHECK(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS == expectedEol);
485 }
486 
487 }
TEST_SUITE("TestConstTensorLayerVisitor")
int GetCurrentThreadId()
Definition: Threads.cpp:27
void ReadBytes(const IPacketBufferPtr &packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
uint64_t ReadUint64(const IPacketBufferPtr &packetBuffer, unsigned int offset)
uint8_t ReadUint8(const IPacketBufferPtr &packetBuffer, unsigned int offset)
bool m_EnableProfiling
Indicates whether external profiling is enabled or not.
Definition: IRuntime.hpp:136
void MarkRead(IPacketBufferPtr &packetBuffer) override
static ProfilingStaticGuid GetStaticId(const std::string &str)
IPacketBufferPtr GetReadableBuffer() override
std::unique_ptr< ISendTimelinePacket > GetSendTimelinePacket() const override
void ResetExternalProfilingOptions(const ExternalProfilingOptions &options, bool resetProfilingService=false)
constexpr unsigned int ThreadIdSize
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
static ProfilingDynamicGuid GetNextGuid()
std::unique_ptr< ISendTimelinePacket > GetSendTimelinePacket() const
ExternalProfilingOptions m_ProfilingOptions
Definition: IRuntime.hpp:151