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