blob: 455533699da2b9cd2a137a86db4ce89dbc23ed3e [file] [log] [blame]
David Monahanc1536d62020-02-12 15:52:35 +00001//
2// Copyright © 2020 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
Finn Williams032bc742020-02-12 11:02:34 +00006#include "CounterDirectory.hpp"
7#include "CounterIdMap.hpp"
8#include "Holder.hpp"
David Monahanc1536d62020-02-12 15:52:35 +00009#include "MockBackend.hpp"
10#include "MockBackendId.hpp"
Finn Williams032bc742020-02-12 11:02:34 +000011#include "PeriodicCounterCapture.hpp"
12#include "PeriodicCounterSelectionCommandHandler.hpp"
13#include "ProfilingStateMachine.hpp"
14#include "ProfilingUtils.hpp"
15#include "RequestCounterDirectoryCommandHandler.hpp"
David Monahanc1536d62020-02-12 15:52:35 +000016
17#include <armnn/BackendId.hpp>
Finn Williams032bc742020-02-12 11:02:34 +000018#include <armnn/Logging.hpp>
Colm Donelanfcb802b2020-02-13 20:47:08 +000019#include <armnn/profiling/ISendTimelinePacket.hpp>
Finn Williams032bc742020-02-12 11:02:34 +000020
21#include <boost/algorithm/string.hpp>
22#include <boost/numeric/conversion/cast.hpp>
David Monahanc1536d62020-02-12 15:52:35 +000023#include <boost/test/unit_test.hpp>
24#include <vector>
25
Finn Williams032bc742020-02-12 11:02:34 +000026#include <cstdint>
27#include <limits>
28#include <backends/BackendProfiling.hpp>
29
30using namespace armnn::profiling;
31
32class ReadCounterVals : public IReadCounterValues
33{
34 virtual bool IsCounterRegistered(uint16_t counterUid) const override
35 {
36 return (counterUid > 4 && counterUid < 11);
37 }
38 virtual uint16_t GetCounterCount() const override
39 {
40 return 1;
41 }
42 virtual uint32_t GetCounterValue(uint16_t counterUid) const override
43 {
44 return counterUid;
45 }
46};
47
48class MockBackendSendCounterPacket : public ISendCounterPacket
49{
50public:
51 using IndexValuePairsVector = std::vector<CounterValue>;
52
53 /// Create and write a StreamMetaDataPacket in the buffer
54 virtual void SendStreamMetaDataPacket() {}
55
56 /// Create and write a CounterDirectoryPacket from the parameters to the buffer.
57 virtual void SendCounterDirectoryPacket(const ICounterDirectory& counterDirectory)
58 {
59 boost::ignore_unused(counterDirectory);
60 }
61
62 /// Create and write a PeriodicCounterCapturePacket from the parameters to the buffer.
63 virtual void SendPeriodicCounterCapturePacket(uint64_t timestamp, const IndexValuePairsVector& values)
64 {
65 m_timestamps.emplace_back(Timestamp{timestamp, values});
66 }
67
68 /// Create and write a PeriodicCounterSelectionPacket from the parameters to the buffer.
69 virtual void SendPeriodicCounterSelectionPacket(uint32_t capturePeriod,
70 const std::vector<uint16_t>& selectedCounterIds)
71 {
72 boost::ignore_unused(capturePeriod);
73 boost::ignore_unused(selectedCounterIds);
74 }
75
76 std::vector<Timestamp> GetTimestamps()
77 {
78 return m_timestamps;
79 }
80
81 void ClearTimestamps()
82 {
83 m_timestamps.clear();
84 }
85
86private:
87 std::vector<Timestamp> m_timestamps;
88};
89
90Packet PacketWriter(uint32_t period, std::vector<uint16_t> countervalues)
91{
92 const uint32_t packetId = 0x40000;
93 uint32_t offset = 0;
94 uint32_t dataLength = static_cast<uint32_t>(4 + countervalues.size() * 2);
95 std::unique_ptr<unsigned char[]> uniqueData = std::make_unique<unsigned char[]>(dataLength);
96 unsigned char* data1 = reinterpret_cast<unsigned char*>(uniqueData.get());
97
98 WriteUint32(data1, offset, period);
99 offset += 4;
100 for (auto countervalue : countervalues)
101 {
102 WriteUint16(data1, offset, countervalue);
103 offset += 2;
104 }
105
106 return {packetId, dataLength, uniqueData};
107}
108
David Monahanc1536d62020-02-12 15:52:35 +0000109BOOST_AUTO_TEST_SUITE(BackendProfilingTestSuite)
110
111BOOST_AUTO_TEST_CASE(BackendProfilingCounterRegisterMockBackendTest)
112{
113 // Reset the profiling service to the uninitialized state
114 armnn::IRuntime::CreationOptions options;
115 options.m_ProfilingOptions.m_EnableProfiling = true;
116 armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance();
117 profilingService.ConfigureProfilingService(options.m_ProfilingOptions, true);
118
119 armnn::MockBackendInitialiser initialiser;
120 // Create a runtime
121 armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
122
123 // Check if the MockBackends 3 dummy counters {0, 1, 2-5 (four cores)} are registered
124 armnn::BackendId mockId = armnn::MockBackendId();
125 const armnn::profiling::ICounterMappings& counterMap = profilingService.GetCounterMappings();
126 BOOST_CHECK(counterMap.GetGlobalId(0, mockId) == 5);
127 BOOST_CHECK(counterMap.GetGlobalId(1, mockId) == 6);
128 BOOST_CHECK(counterMap.GetGlobalId(2, mockId) == 7);
129 BOOST_CHECK(counterMap.GetGlobalId(3, mockId) == 8);
130 BOOST_CHECK(counterMap.GetGlobalId(4, mockId) == 9);
131 BOOST_CHECK(counterMap.GetGlobalId(5, mockId) == 10);
132 options.m_ProfilingOptions.m_EnableProfiling = false;
133 profilingService.ResetExternalProfilingOptions(options.m_ProfilingOptions, true);
134}
135
Finn Williams032bc742020-02-12 11:02:34 +0000136BOOST_AUTO_TEST_CASE(TestBackendCounters)
137{
138 Holder holder;
139 PacketVersionResolver packetVersionResolver;
140 ProfilingStateMachine stateMachine;
141 ReadCounterVals readCounterVals;
142 CounterIdMap counterIdMap;
143 MockBackendSendCounterPacket sendCounterPacket;
144
145 const armnn::BackendId cpuAccId(armnn::Compute::CpuAcc);
146 const armnn::BackendId gpuAccId(armnn::Compute::GpuAcc);
147
148 armnn::IRuntime::CreationOptions options;
149 options.m_ProfilingOptions.m_EnableProfiling = true;
150
151 armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance();
152
153 std::unique_ptr<armnn::profiling::IBackendProfiling> cpuBackendProfilingPtr =
154 std::make_unique<BackendProfiling>(options, profilingService, cpuAccId);
155 std::unique_ptr<armnn::profiling::IBackendProfiling> gpuBackendProfilingPtr =
156 std::make_unique<BackendProfiling>(options, profilingService, gpuAccId);
157
158 std::shared_ptr<armnn::profiling::IBackendProfilingContext> cpuProfilingContextPtr =
159 std::make_shared<armnn::MockBackendProfilingContext>(cpuBackendProfilingPtr);
160 std::shared_ptr<armnn::profiling::IBackendProfilingContext> gpuProfilingContextPtr =
161 std::make_shared<armnn::MockBackendProfilingContext>(gpuBackendProfilingPtr);
162
163 std::unordered_map<armnn::BackendId,
164 std::shared_ptr<armnn::profiling::IBackendProfilingContext>> backendProfilingContexts;
165
166 backendProfilingContexts[cpuAccId] = cpuProfilingContextPtr;
167 backendProfilingContexts[gpuAccId] = gpuProfilingContextPtr;
168
169 uint16_t globalId = 5;
170
171 counterIdMap.RegisterMapping(globalId++, 0, cpuAccId);
172 counterIdMap.RegisterMapping(globalId++, 1, cpuAccId);
173 counterIdMap.RegisterMapping(globalId++, 2, cpuAccId);
174
175 counterIdMap.RegisterMapping(globalId++, 0, gpuAccId);
176 counterIdMap.RegisterMapping(globalId++, 1, gpuAccId);
177 counterIdMap.RegisterMapping(globalId++, 2, gpuAccId);
178
179 backendProfilingContexts[cpuAccId] = cpuProfilingContextPtr;
180 backendProfilingContexts[gpuAccId] = gpuProfilingContextPtr;
181
182 PeriodicCounterCapture periodicCounterCapture(holder, sendCounterPacket, readCounterVals,
183 counterIdMap, backendProfilingContexts);
184
185 uint16_t maxArmnnCounterId = 4;
186
187 PeriodicCounterSelectionCommandHandler periodicCounterSelectionCommandHandler(0,
188 4,
189 packetVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue(),
190 backendProfilingContexts,
191 counterIdMap,
192 holder,
193 maxArmnnCounterId,
194 periodicCounterCapture,
195 readCounterVals,
196 sendCounterPacket,
197 stateMachine);
198
199 stateMachine.TransitionToState(ProfilingState::NotConnected);
200 stateMachine.TransitionToState(ProfilingState::WaitingForAck);
201 stateMachine.TransitionToState(ProfilingState::Active);
202
203 uint32_t period = 12345u;
204
205 std::vector<uint16_t> cpuCounters{5, 6, 7};
206 std::vector<uint16_t> gpuCounters{8, 9, 10};
207
208 // Request only gpu counters
209 periodicCounterSelectionCommandHandler(PacketWriter(period, gpuCounters));
210 periodicCounterCapture.Stop();
211
212 std::set<armnn::BackendId> activeIds = holder.GetCaptureData().GetActiveBackends();
213 BOOST_CHECK(activeIds.size() == 1);
214 BOOST_CHECK(activeIds.find(gpuAccId) != activeIds.end());
215
216 std::vector<Timestamp> recievedTimestamp = sendCounterPacket.GetTimestamps();
217
218 BOOST_CHECK(recievedTimestamp[0].timestamp == period);
219 BOOST_CHECK(recievedTimestamp.size() == 1);
220 BOOST_CHECK(recievedTimestamp[0].counterValues.size() == gpuCounters.size());
221 for (unsigned long i=0; i< gpuCounters.size(); ++i)
222 {
223 BOOST_CHECK(recievedTimestamp[0].counterValues[i].counterId == gpuCounters[i]);
224 BOOST_CHECK(recievedTimestamp[0].counterValues[i].counterValue == i + 1u);
225 }
226 sendCounterPacket.ClearTimestamps();
227
228 // Request only cpu counters
229 periodicCounterSelectionCommandHandler(PacketWriter(period, cpuCounters));
230 periodicCounterCapture.Stop();
231
232 activeIds = holder.GetCaptureData().GetActiveBackends();
233 BOOST_CHECK(activeIds.size() == 1);
234 BOOST_CHECK(activeIds.find(cpuAccId) != activeIds.end());
235
236 recievedTimestamp = sendCounterPacket.GetTimestamps();
237
238 BOOST_CHECK(recievedTimestamp[0].timestamp == period);
239 BOOST_CHECK(recievedTimestamp.size() == 1);
240 BOOST_CHECK(recievedTimestamp[0].counterValues.size() == cpuCounters.size());
241 for (unsigned long i=0; i< cpuCounters.size(); ++i)
242 {
243 BOOST_CHECK(recievedTimestamp[0].counterValues[i].counterId == cpuCounters[i]);
244 BOOST_CHECK(recievedTimestamp[0].counterValues[i].counterValue == i + 1u);
245 }
246 sendCounterPacket.ClearTimestamps();
247
248 // Request combination of cpu & gpu counters with new period
249 period = 12222u;
250 periodicCounterSelectionCommandHandler(PacketWriter(period, {cpuCounters[0], gpuCounters[2],
251 gpuCounters[1], cpuCounters[1], gpuCounters[0]}));
252 periodicCounterCapture.Stop();
253
254 activeIds = holder.GetCaptureData().GetActiveBackends();
255 BOOST_CHECK(activeIds.size() == 2);
256 BOOST_CHECK(activeIds.find(cpuAccId) != activeIds.end());
257 BOOST_CHECK(activeIds.find(gpuAccId) != activeIds.end());
258
259 recievedTimestamp = sendCounterPacket.GetTimestamps();
260
261 BOOST_CHECK(recievedTimestamp[0].timestamp == period);
262 BOOST_CHECK(recievedTimestamp[1].timestamp == period);
263
264 BOOST_CHECK(recievedTimestamp.size() == 2);
265 BOOST_CHECK(recievedTimestamp[0].counterValues.size() == 2);
266 BOOST_CHECK(recievedTimestamp[1].counterValues.size() == gpuCounters.size());
267
268 BOOST_CHECK(recievedTimestamp[0].counterValues[0].counterId == cpuCounters[0]);
269 BOOST_CHECK(recievedTimestamp[0].counterValues[0].counterValue == 1u);
270 BOOST_CHECK(recievedTimestamp[0].counterValues[1].counterId == cpuCounters[1]);
271 BOOST_CHECK(recievedTimestamp[0].counterValues[1].counterValue == 2u);
272
273 for (unsigned long i=0; i< gpuCounters.size(); ++i)
274 {
275 BOOST_CHECK(recievedTimestamp[1].counterValues[i].counterId == gpuCounters[i]);
276 BOOST_CHECK(recievedTimestamp[1].counterValues[i].counterValue == i + 1u);
277 }
278
279 sendCounterPacket.ClearTimestamps();
280
281 // Request all counters
282 std::vector<uint16_t> counterValues;
283 counterValues.insert(counterValues.begin(), cpuCounters.begin(), cpuCounters.end());
284 counterValues.insert(counterValues.begin(), gpuCounters.begin(), gpuCounters.end());
285
286 periodicCounterSelectionCommandHandler(PacketWriter(period, counterValues));
287 periodicCounterCapture.Stop();
288
289 activeIds = holder.GetCaptureData().GetActiveBackends();
290 BOOST_CHECK(activeIds.size() == 2);
291 BOOST_CHECK(activeIds.find(cpuAccId) != activeIds.end());
292 BOOST_CHECK(activeIds.find(gpuAccId) != activeIds.end());
293
294 recievedTimestamp = sendCounterPacket.GetTimestamps();
295
296 BOOST_CHECK(recievedTimestamp[0].counterValues.size() == cpuCounters.size());
297 for (unsigned long i=0; i< cpuCounters.size(); ++i)
298 {
299 BOOST_CHECK(recievedTimestamp[0].counterValues[i].counterId == cpuCounters[i]);
300 BOOST_CHECK(recievedTimestamp[0].counterValues[i].counterValue == i + 1u);
301 }
302
303 BOOST_CHECK(recievedTimestamp[1].counterValues.size() == gpuCounters.size());
304 for (unsigned long i=0; i< gpuCounters.size(); ++i)
305 {
306 BOOST_CHECK(recievedTimestamp[1].counterValues[i].counterId == gpuCounters[i]);
307 BOOST_CHECK(recievedTimestamp[1].counterValues[i].counterValue == i + 1u);
308 }
309 sendCounterPacket.ClearTimestamps();
310
311 // Request random counters with duplicates and invalid counters
312 counterValues = {0, 0, 200, cpuCounters[2], gpuCounters[0],3 ,30, cpuCounters[0],cpuCounters[2], gpuCounters[1], 3,
313 90, 0, 30, gpuCounters[0], gpuCounters[0]};
314
315 periodicCounterSelectionCommandHandler(PacketWriter(period, counterValues));
316 periodicCounterCapture.Stop();
317
318 activeIds = holder.GetCaptureData().GetActiveBackends();
319 BOOST_CHECK(activeIds.size() == 2);
320 BOOST_CHECK(activeIds.find(cpuAccId) != activeIds.end());
321 BOOST_CHECK(activeIds.find(gpuAccId) != activeIds.end());
322
323 recievedTimestamp = sendCounterPacket.GetTimestamps();
324
325 BOOST_CHECK(recievedTimestamp.size() == 2);
326
327 BOOST_CHECK(recievedTimestamp[0].counterValues.size() == 2);
328
329 BOOST_CHECK(recievedTimestamp[0].counterValues[0].counterId == cpuCounters[0]);
330 BOOST_CHECK(recievedTimestamp[0].counterValues[0].counterValue == 1u);
331 BOOST_CHECK(recievedTimestamp[0].counterValues[1].counterId == cpuCounters[2]);
332 BOOST_CHECK(recievedTimestamp[0].counterValues[1].counterValue == 3u);
333
334 BOOST_CHECK(recievedTimestamp[1].counterValues.size() == 2);
335
336 BOOST_CHECK(recievedTimestamp[1].counterValues[0].counterId == gpuCounters[0]);
337 BOOST_CHECK(recievedTimestamp[1].counterValues[0].counterValue == 1u);
338 BOOST_CHECK(recievedTimestamp[1].counterValues[1].counterId == gpuCounters[1]);
339 BOOST_CHECK(recievedTimestamp[1].counterValues[1].counterValue == 2u);
340
341 sendCounterPacket.ClearTimestamps();
342
343 // Request no counters
344 periodicCounterSelectionCommandHandler(PacketWriter(period, {}));
345 periodicCounterCapture.Stop();
346
347 activeIds = holder.GetCaptureData().GetActiveBackends();
348 BOOST_CHECK(activeIds.size() == 0);
349
350 recievedTimestamp = sendCounterPacket.GetTimestamps();
351 BOOST_CHECK(recievedTimestamp.size() == 0);
352
353 sendCounterPacket.ClearTimestamps();
354
355 // Request period of zero
356 periodicCounterSelectionCommandHandler(PacketWriter(0, counterValues));
357 periodicCounterCapture.Stop();
358
359 activeIds = holder.GetCaptureData().GetActiveBackends();
360 BOOST_CHECK(activeIds.size() == 0);
361
362 recievedTimestamp = sendCounterPacket.GetTimestamps();
363 BOOST_CHECK(recievedTimestamp.size() == 0);
364}
365
366BOOST_AUTO_TEST_CASE(TestBackendCounterLogging)
367{
368 std::stringstream ss;
369
370 struct StreamRedirector
371 {
372 public:
373 StreamRedirector(std::ostream &stream, std::streambuf *newStreamBuffer)
374 : m_Stream(stream), m_BackupBuffer(m_Stream.rdbuf(newStreamBuffer))
375 {}
376
377 ~StreamRedirector()
378 { m_Stream.rdbuf(m_BackupBuffer); }
379
380 private:
381 std::ostream &m_Stream;
382 std::streambuf *m_BackupBuffer;
383 };
384
385 Holder holder;
386 PacketVersionResolver packetVersionResolver;
387 ProfilingStateMachine stateMachine;
388 ReadCounterVals readCounterVals;
389 StreamRedirector redirect(std::cout, ss.rdbuf());
390 CounterIdMap counterIdMap;
391 MockBackendSendCounterPacket sendCounterPacket;
392
393 const armnn::BackendId cpuAccId(armnn::Compute::CpuAcc);
394 const armnn::BackendId gpuAccId(armnn::Compute::GpuAcc);
395
396 armnn::IRuntime::CreationOptions options;
397 options.m_ProfilingOptions.m_EnableProfiling = true;
398
399 armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance();
400
401 std::unique_ptr<armnn::profiling::IBackendProfiling> cpuBackendProfilingPtr =
402 std::make_unique<BackendProfiling>(options, profilingService, cpuAccId);
403
404 std::shared_ptr<armnn::profiling::IBackendProfilingContext> cpuProfilingContextPtr =
405 std::make_shared<armnn::MockBackendProfilingContext>(cpuBackendProfilingPtr);
406
407 std::unordered_map<armnn::BackendId,
408 std::shared_ptr<armnn::profiling::IBackendProfilingContext>> backendProfilingContexts;
409
410 uint16_t globalId = 5;
411 counterIdMap.RegisterMapping(globalId, 0, cpuAccId);
412 backendProfilingContexts[cpuAccId] = cpuProfilingContextPtr;
413
414 PeriodicCounterCapture periodicCounterCapture(holder, sendCounterPacket, readCounterVals,
415 counterIdMap, backendProfilingContexts);
416
417 uint16_t maxArmnnCounterId = 4;
418
419 PeriodicCounterSelectionCommandHandler periodicCounterSelectionCommandHandler(0,
420 4,
421 packetVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue(),
422 backendProfilingContexts,
423 counterIdMap,
424 holder,
425 maxArmnnCounterId,
426 periodicCounterCapture,
427 readCounterVals,
428 sendCounterPacket,
429 stateMachine);
430
431 stateMachine.TransitionToState(ProfilingState::NotConnected);
432 stateMachine.TransitionToState(ProfilingState::WaitingForAck);
433 stateMachine.TransitionToState(ProfilingState::Active);
434
435 uint32_t period = 15939u;
436
437 armnn::SetAllLoggingSinks(true, false, false);
438 SetLogFilter(armnn::LogSeverity::Warning);
439 periodicCounterSelectionCommandHandler(PacketWriter(period, {5}));
440 periodicCounterCapture.Stop();
441 SetLogFilter(armnn::LogSeverity::Fatal);
442
443 BOOST_CHECK(boost::contains(ss.str(), "ActivateCounters example test error"));
444}
445
Colm Donelanfcb802b2020-02-13 20:47:08 +0000446BOOST_AUTO_TEST_CASE(BackendProfilingContextGetSendTimelinePacket)
447{
448 // Reset the profiling service to the uninitialized state
449 armnn::IRuntime::CreationOptions options;
450 options.m_ProfilingOptions.m_EnableProfiling = true;
451 armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance();
452 profilingService.ConfigureProfilingService(options.m_ProfilingOptions, true);
453
454 armnn::MockBackendInitialiser initialiser;
455 // Create a runtime. During this the mock backend will be registered and context returned.
456 armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
457 armnn::MockBackendProfilingService mockProfilingService = armnn::MockBackendProfilingService::Instance();
458 armnn::MockBackendProfilingContext *mockBackEndProfilingContext = mockProfilingService.GetContext();
459 // Check that there is a valid context set.
460 BOOST_CHECK(mockBackEndProfilingContext);
461 armnn::IBackendInternal::IBackendProfilingPtr& backendProfilingIface =
462 mockBackEndProfilingContext->GetBackendProfiling();
463 BOOST_CHECK(backendProfilingIface);
464
465 // Now for the meat of the test. We're just going to send a random packet and make sure there
466 // are no exceptions or errors. The sending of packets is already tested in SendTimelinePacketTests.
467 std::unique_ptr<armnn::profiling::ISendTimelinePacket> timelinePacket =
468 backendProfilingIface->GetSendTimelinePacket();
469 // Send TimelineEntityClassBinaryPacket
470 const uint64_t entityBinaryPacketProfilingGuid = 123456u;
471 timelinePacket->SendTimelineEntityBinaryPacket(entityBinaryPacketProfilingGuid);
472 timelinePacket->Commit();
473
474 // Reset the profiling servie after the test.
475 options.m_ProfilingOptions.m_EnableProfiling = false;
476 profilingService.ResetExternalProfilingOptions(options.m_ProfilingOptions, true);
477}
478
479BOOST_AUTO_TEST_CASE(GetProfilingGuidGenerator)
480{
481 // Reset the profiling service to the uninitialized state
482 armnn::IRuntime::CreationOptions options;
483 options.m_ProfilingOptions.m_EnableProfiling = true;
484 armnn::profiling::ProfilingService& profilingService = armnn::profiling::ProfilingService::Instance();
485 profilingService.ConfigureProfilingService(options.m_ProfilingOptions, true);
486
487 armnn::MockBackendInitialiser initialiser;
488 // Create a runtime. During this the mock backend will be registered and context returned.
489 armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options));
490 armnn::MockBackendProfilingService mockProfilingService = armnn::MockBackendProfilingService::Instance();
491 armnn::MockBackendProfilingContext *mockBackEndProfilingContext = mockProfilingService.GetContext();
492 // Check that there is a valid context set.
493 BOOST_CHECK(mockBackEndProfilingContext);
494 armnn::IBackendInternal::IBackendProfilingPtr& backendProfilingIface =
495 mockBackEndProfilingContext->GetBackendProfiling();
496 BOOST_CHECK(backendProfilingIface);
497
498 // Get the Guid generator and check the getting two Guid's results in the second being greater than the first.
499 armnn::profiling::IProfilingGuidGenerator& guidGenerator = backendProfilingIface->GetProfilingGuidGenerator();
500 BOOST_CHECK(backendProfilingIface);
501 const armnn::profiling::ProfilingDynamicGuid& firstGuid = guidGenerator.NextGuid();
502 BOOST_CHECK(firstGuid);
503 const armnn::profiling::ProfilingDynamicGuid& secondGuid = guidGenerator.NextGuid();
504 BOOST_CHECK(secondGuid > firstGuid);
505
506 // Reset the profiling servie after the test.
507 options.m_ProfilingOptions.m_EnableProfiling = false;
508 profilingService.ResetExternalProfilingOptions(options.m_ProfilingOptions, true);
509}
510
511BOOST_AUTO_TEST_SUITE_END()