Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2019 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 8 | #include <SendCounterPacket.hpp> |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 9 | #include <SendThread.hpp> |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 10 | #include <ProfilingUtils.hpp> |
Matteo Martincigh | e848538 | 2019-10-10 14:08:21 +0100 | [diff] [blame] | 11 | #include <IProfilingConnectionFactory.hpp> |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 12 | |
| 13 | #include <armnn/Exceptions.hpp> |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 14 | #include <armnn/Optional.hpp> |
| 15 | #include <armnn/Conversion.hpp> |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 16 | |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 17 | #include <boost/assert.hpp> |
Derek Lamberti | f143fba | 2020-01-02 13:50:57 +0000 | [diff] [blame] | 18 | #include <boost/core/ignore_unused.hpp> |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 19 | #include <boost/numeric/conversion/cast.hpp> |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 20 | |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 21 | #include <atomic> |
| 22 | #include <condition_variable> |
| 23 | #include <mutex> |
| 24 | #include <thread> |
| 25 | |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 26 | namespace armnn |
| 27 | { |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 28 | |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 29 | namespace profiling |
| 30 | { |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 31 | |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 32 | class MockProfilingConnection : public IProfilingConnection |
| 33 | { |
| 34 | public: |
| 35 | MockProfilingConnection() |
| 36 | : m_IsOpen(true) |
Matteo Martincigh | 54fb957 | 2019-10-02 12:50:57 +0100 | [diff] [blame] | 37 | , m_WrittenData() |
| 38 | , m_Packet() |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 39 | {} |
| 40 | |
Finn Williams | 09ad6f9 | 2019-12-19 17:05:18 +0000 | [diff] [blame] | 41 | enum class PacketType |
| 42 | { |
| 43 | StreamMetaData, |
| 44 | ConnectionAcknowledge, |
| 45 | CounterDirectory, |
| 46 | ReqCounterDirectory, |
| 47 | PeriodicCounterSelection, |
| 48 | PerJobCounterSelection, |
| 49 | TimelineMessageDirectory, |
| 50 | PeriodicCounterCapture, |
| 51 | Unknown |
| 52 | }; |
| 53 | |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 54 | bool IsOpen() const override |
| 55 | { |
| 56 | std::lock_guard<std::mutex> lock(m_Mutex); |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 57 | |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 58 | return m_IsOpen; |
| 59 | } |
| 60 | |
| 61 | void Close() override |
| 62 | { |
| 63 | std::lock_guard<std::mutex> lock(m_Mutex); |
| 64 | |
| 65 | m_IsOpen = false; |
| 66 | } |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 67 | |
| 68 | bool WritePacket(const unsigned char* buffer, uint32_t length) override |
| 69 | { |
Matteo Martincigh | 5d737fb | 2019-10-07 13:05:13 +0100 | [diff] [blame] | 70 | if (buffer == nullptr || length == 0) |
| 71 | { |
| 72 | return false; |
| 73 | } |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 74 | |
Finn Williams | 09ad6f9 | 2019-12-19 17:05:18 +0000 | [diff] [blame] | 75 | uint32_t header = ReadUint32(buffer, 0); |
| 76 | |
| 77 | uint32_t packetFamily = (header >> 26); |
| 78 | uint32_t packetId = ((header >> 16) & 1023); |
| 79 | |
| 80 | PacketType packetType; |
| 81 | |
| 82 | switch (packetFamily) |
| 83 | { |
| 84 | case 0: |
| 85 | packetType = packetId < 6 ? PacketType(packetId) : PacketType::Unknown; |
| 86 | break; |
| 87 | case 1: |
| 88 | packetType = packetId == 0 ? PacketType::TimelineMessageDirectory : PacketType::Unknown; |
| 89 | break; |
| 90 | case 3: |
| 91 | packetType = packetId == 0 ? PacketType::PeriodicCounterCapture : PacketType::Unknown; |
| 92 | break; |
| 93 | default: |
| 94 | packetType = PacketType::Unknown; |
| 95 | } |
| 96 | |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 97 | std::lock_guard<std::mutex> lock(m_Mutex); |
| 98 | |
Finn Williams | 09ad6f9 | 2019-12-19 17:05:18 +0000 | [diff] [blame] | 99 | m_WrittenData.push_back({ packetType, length }); |
Matteo Martincigh | 5d737fb | 2019-10-07 13:05:13 +0100 | [diff] [blame] | 100 | return true; |
Narumol Prangnawarat | 0ec068f | 2019-09-30 16:20:20 +0100 | [diff] [blame] | 101 | } |
Finn Williams | 09ad6f9 | 2019-12-19 17:05:18 +0000 | [diff] [blame] | 102 | |
| 103 | long CheckForPacket(const std::pair<PacketType, uint32_t> packetInfo) |
| 104 | { |
| 105 | std::lock_guard<std::mutex> lock(m_Mutex); |
| 106 | |
| 107 | if(packetInfo.second != 0) |
| 108 | { |
| 109 | return std::count(m_WrittenData.begin(), m_WrittenData.end(), packetInfo); |
| 110 | } |
| 111 | else |
| 112 | { |
| 113 | return std::count_if(m_WrittenData.begin(), m_WrittenData.end(), |
| 114 | [&packetInfo](const std::pair<PacketType, uint32_t> pair) { return packetInfo.first == pair.first; }); |
| 115 | } |
| 116 | } |
| 117 | |
Matteo Martincigh | 54fb957 | 2019-10-02 12:50:57 +0100 | [diff] [blame] | 118 | bool WritePacket(Packet&& packet) |
| 119 | { |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 120 | std::lock_guard<std::mutex> lock(m_Mutex); |
| 121 | |
Matteo Martincigh | 54fb957 | 2019-10-02 12:50:57 +0100 | [diff] [blame] | 122 | m_Packet = std::move(packet); |
| 123 | return true; |
| 124 | } |
Narumol Prangnawarat | 0ec068f | 2019-09-30 16:20:20 +0100 | [diff] [blame] | 125 | |
Matteo Martincigh | 54fb957 | 2019-10-02 12:50:57 +0100 | [diff] [blame] | 126 | Packet ReadPacket(uint32_t timeout) override |
| 127 | { |
Derek Lamberti | 1dd75b3 | 2019-12-10 21:23:23 +0000 | [diff] [blame] | 128 | boost::ignore_unused(timeout); |
| 129 | |
Colm Donelan | 2ba48d2 | 2019-11-29 09:10:59 +0000 | [diff] [blame] | 130 | // Simulate a delay in the reading process. The default timeout is way too long. |
| 131 | std::this_thread::sleep_for(std::chrono::milliseconds(5)); |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 132 | std::lock_guard<std::mutex> lock(m_Mutex); |
Matteo Martincigh | 54fb957 | 2019-10-02 12:50:57 +0100 | [diff] [blame] | 133 | return std::move(m_Packet); |
| 134 | } |
Narumol Prangnawarat | 0ec068f | 2019-09-30 16:20:20 +0100 | [diff] [blame] | 135 | |
Finn Williams | 09ad6f9 | 2019-12-19 17:05:18 +0000 | [diff] [blame] | 136 | unsigned long GetWrittenDataSize() |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 137 | { |
| 138 | std::lock_guard<std::mutex> lock(m_Mutex); |
Matteo Martincigh | 5d737fb | 2019-10-07 13:05:13 +0100 | [diff] [blame] | 139 | |
Finn Williams | 09ad6f9 | 2019-12-19 17:05:18 +0000 | [diff] [blame] | 140 | return m_WrittenData.size(); |
Colm Donelan | 2ba48d2 | 2019-11-29 09:10:59 +0000 | [diff] [blame] | 141 | } |
| 142 | |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 143 | void Clear() |
| 144 | { |
| 145 | std::lock_guard<std::mutex> lock(m_Mutex); |
| 146 | |
| 147 | m_WrittenData.clear(); |
| 148 | } |
Narumol Prangnawarat | 0ec068f | 2019-09-30 16:20:20 +0100 | [diff] [blame] | 149 | |
| 150 | private: |
| 151 | bool m_IsOpen; |
Finn Williams | 09ad6f9 | 2019-12-19 17:05:18 +0000 | [diff] [blame] | 152 | std::vector<std::pair<PacketType, uint32_t>> m_WrittenData; |
Matteo Martincigh | 54fb957 | 2019-10-02 12:50:57 +0100 | [diff] [blame] | 153 | Packet m_Packet; |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 154 | mutable std::mutex m_Mutex; |
Narumol Prangnawarat | 0ec068f | 2019-09-30 16:20:20 +0100 | [diff] [blame] | 155 | }; |
| 156 | |
Matteo Martincigh | e848538 | 2019-10-10 14:08:21 +0100 | [diff] [blame] | 157 | class MockProfilingConnectionFactory : public IProfilingConnectionFactory |
| 158 | { |
| 159 | public: |
| 160 | IProfilingConnectionPtr GetProfilingConnection(const ExternalProfilingOptions& options) const override |
| 161 | { |
Derek Lamberti | 1dd75b3 | 2019-12-10 21:23:23 +0000 | [diff] [blame] | 162 | boost::ignore_unused(options); |
Matteo Martincigh | e848538 | 2019-10-10 14:08:21 +0100 | [diff] [blame] | 163 | return std::make_unique<MockProfilingConnection>(); |
| 164 | } |
| 165 | }; |
| 166 | |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 167 | class MockPacketBuffer : public IPacketBuffer |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 168 | { |
| 169 | public: |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 170 | MockPacketBuffer(unsigned int maxSize) |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 171 | : m_MaxSize(maxSize) |
| 172 | , m_Size(0) |
| 173 | , m_Data(std::make_unique<unsigned char[]>(m_MaxSize)) |
| 174 | {} |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 175 | |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 176 | ~MockPacketBuffer() {} |
| 177 | |
Matteo Martincigh | 76c50d8 | 2019-11-21 12:10:42 +0000 | [diff] [blame] | 178 | const unsigned char* GetReadableData() const override { return m_Data.get(); } |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 179 | |
| 180 | unsigned int GetSize() const override { return m_Size; } |
| 181 | |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 182 | void MarkRead() override { m_Size = 0; } |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 183 | |
| 184 | void Commit(unsigned int size) override { m_Size = size; } |
| 185 | |
| 186 | void Release() override { m_Size = 0; } |
| 187 | |
| 188 | unsigned char* GetWritableData() override { return m_Data.get(); } |
| 189 | |
| 190 | private: |
| 191 | unsigned int m_MaxSize; |
| 192 | unsigned int m_Size; |
| 193 | std::unique_ptr<unsigned char[]> m_Data; |
| 194 | }; |
| 195 | |
| 196 | class MockBufferManager : public IBufferManager |
| 197 | { |
| 198 | public: |
| 199 | MockBufferManager(unsigned int size) |
| 200 | : m_BufferSize(size), |
| 201 | m_Buffer(std::make_unique<MockPacketBuffer>(size)) {} |
| 202 | |
| 203 | ~MockBufferManager() {} |
| 204 | |
Matteo Martincigh | 2ffcc41 | 2019-11-05 11:47:40 +0000 | [diff] [blame] | 205 | IPacketBufferPtr Reserve(unsigned int requestedSize, unsigned int& reservedSize) override |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 206 | { |
| 207 | if (requestedSize > m_BufferSize) |
| 208 | { |
| 209 | reservedSize = m_BufferSize; |
| 210 | } |
| 211 | else |
| 212 | { |
| 213 | reservedSize = requestedSize; |
| 214 | } |
| 215 | |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 216 | return std::move(m_Buffer); |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 217 | } |
| 218 | |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 219 | void Commit(IPacketBufferPtr& packetBuffer, unsigned int size, bool notifyConsumer = true) override |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 220 | { |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 221 | packetBuffer->Commit(size); |
| 222 | m_Buffer = std::move(packetBuffer); |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 223 | |
| 224 | if (notifyConsumer) |
| 225 | { |
| 226 | FlushReadList(); |
| 227 | } |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 228 | } |
| 229 | |
Matteo Martincigh | 2ffcc41 | 2019-11-05 11:47:40 +0000 | [diff] [blame] | 230 | IPacketBufferPtr GetReadableBuffer() override |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 231 | { |
| 232 | return std::move(m_Buffer); |
| 233 | } |
| 234 | |
Matteo Martincigh | 2ffcc41 | 2019-11-05 11:47:40 +0000 | [diff] [blame] | 235 | void Release(IPacketBufferPtr& packetBuffer) override |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 236 | { |
| 237 | packetBuffer->Release(); |
| 238 | m_Buffer = std::move(packetBuffer); |
| 239 | } |
| 240 | |
Matteo Martincigh | 2ffcc41 | 2019-11-05 11:47:40 +0000 | [diff] [blame] | 241 | void MarkRead(IPacketBufferPtr& packetBuffer) override |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 242 | { |
| 243 | packetBuffer->MarkRead(); |
| 244 | m_Buffer = std::move(packetBuffer); |
| 245 | } |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 246 | |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 247 | void SetConsumer(IConsumer* consumer) override |
| 248 | { |
| 249 | if (consumer != nullptr) |
| 250 | { |
| 251 | m_Consumer = consumer; |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | void FlushReadList() override |
| 256 | { |
| 257 | // notify consumer that packet is ready to read |
| 258 | if (m_Consumer != nullptr) |
| 259 | { |
| 260 | m_Consumer->SetReadyToRead(); |
| 261 | } |
| 262 | } |
| 263 | |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 264 | private: |
| 265 | unsigned int m_BufferSize; |
Matteo Martincigh | 2ffcc41 | 2019-11-05 11:47:40 +0000 | [diff] [blame] | 266 | IPacketBufferPtr m_Buffer; |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 267 | IConsumer* m_Consumer = nullptr; |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 268 | }; |
| 269 | |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 270 | class MockStreamCounterBuffer : public IBufferManager |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 271 | { |
| 272 | public: |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 273 | MockStreamCounterBuffer(unsigned int maxBufferSize = 4096) |
| 274 | : m_MaxBufferSize(maxBufferSize) |
| 275 | , m_BufferList() |
| 276 | , m_CommittedSize(0) |
| 277 | , m_ReadableSize(0) |
| 278 | , m_ReadSize(0) |
| 279 | {} |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 280 | ~MockStreamCounterBuffer() {} |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 281 | |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 282 | IPacketBufferPtr Reserve(unsigned int requestedSize, unsigned int& reservedSize) override |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 283 | { |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 284 | std::lock_guard<std::mutex> lock(m_Mutex); |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 285 | |
| 286 | reservedSize = 0; |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 287 | if (requestedSize > m_MaxBufferSize) |
Narumol Prangnawarat | 7be47ef | 2019-09-27 18:00:11 +0100 | [diff] [blame] | 288 | { |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 289 | throw armnn::InvalidArgumentException("The maximum buffer size that can be requested is [" + |
| 290 | std::to_string(m_MaxBufferSize) + "] bytes"); |
Narumol Prangnawarat | 7be47ef | 2019-09-27 18:00:11 +0100 | [diff] [blame] | 291 | } |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 292 | reservedSize = requestedSize; |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 293 | return std::make_unique<MockPacketBuffer>(requestedSize); |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 294 | } |
| 295 | |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 296 | void Commit(IPacketBufferPtr& packetBuffer, unsigned int size, bool notifyConsumer = true) override |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 297 | { |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 298 | std::lock_guard<std::mutex> lock(m_Mutex); |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 299 | |
| 300 | packetBuffer->Commit(size); |
| 301 | m_BufferList.push_back(std::move(packetBuffer)); |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 302 | m_CommittedSize += size; |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 303 | |
| 304 | if (notifyConsumer) |
| 305 | { |
| 306 | FlushReadList(); |
| 307 | } |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 308 | } |
| 309 | |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 310 | void Release(IPacketBufferPtr& packetBuffer) override |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 311 | { |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 312 | std::lock_guard<std::mutex> lock(m_Mutex); |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 313 | |
| 314 | packetBuffer->Release(); |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 315 | } |
| 316 | |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 317 | IPacketBufferPtr GetReadableBuffer() override |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 318 | { |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 319 | std::lock_guard<std::mutex> lock(m_Mutex); |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 320 | |
| 321 | if (m_BufferList.empty()) |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 322 | { |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 323 | return nullptr; |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 324 | } |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 325 | IPacketBufferPtr buffer = std::move(m_BufferList.back()); |
| 326 | m_BufferList.pop_back(); |
| 327 | m_ReadableSize += buffer->GetSize(); |
| 328 | return buffer; |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 329 | } |
| 330 | |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 331 | void MarkRead(IPacketBufferPtr& packetBuffer) override |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 332 | { |
Matteo Martincigh | d0613b5 | 2019-10-09 16:47:04 +0100 | [diff] [blame] | 333 | std::lock_guard<std::mutex> lock(m_Mutex); |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 334 | |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 335 | m_ReadSize += packetBuffer->GetSize(); |
| 336 | packetBuffer->MarkRead(); |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 337 | } |
| 338 | |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 339 | void SetConsumer(IConsumer* consumer) override |
| 340 | { |
| 341 | if (consumer != nullptr) |
| 342 | { |
| 343 | m_Consumer = consumer; |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | void FlushReadList() override |
| 348 | { |
| 349 | // notify consumer that packet is ready to read |
| 350 | if (m_Consumer != nullptr) |
| 351 | { |
| 352 | m_Consumer->SetReadyToRead(); |
| 353 | } |
| 354 | } |
| 355 | |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 356 | unsigned int GetCommittedSize() const { return m_CommittedSize; } |
| 357 | unsigned int GetReadableSize() const { return m_ReadableSize; } |
| 358 | unsigned int GetReadSize() const { return m_ReadSize; } |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 359 | |
| 360 | private: |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 361 | // The maximum buffer size when creating a new buffer |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 362 | unsigned int m_MaxBufferSize; |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 363 | |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 364 | // A list of buffers |
| 365 | std::vector<IPacketBufferPtr> m_BufferList; |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 366 | |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 367 | // The mutex to synchronize this mock's methods |
| 368 | std::mutex m_Mutex; |
| 369 | |
| 370 | // The total size of the buffers that has been committed for reading |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 371 | unsigned int m_CommittedSize; |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 372 | |
Matteo Martincigh | 61d6f73 | 2019-10-03 11:21:18 +0100 | [diff] [blame] | 373 | // The total size of the buffers that can be read |
| 374 | unsigned int m_ReadableSize; |
| 375 | |
| 376 | // The total size of the buffers that has already been read |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 377 | unsigned int m_ReadSize; |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 378 | |
| 379 | // Consumer thread to notify packet is ready to read |
| 380 | IConsumer* m_Consumer = nullptr; |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 381 | }; |
| 382 | |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 383 | class MockSendCounterPacket : public ISendCounterPacket |
| 384 | { |
| 385 | public: |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 386 | MockSendCounterPacket(IBufferManager& sendBuffer) : m_BufferManager(sendBuffer) {} |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 387 | |
| 388 | void SendStreamMetaDataPacket() override |
| 389 | { |
| 390 | std::string message("SendStreamMetaDataPacket"); |
| 391 | unsigned int reserved = 0; |
Matteo Martincigh | 2ffcc41 | 2019-11-05 11:47:40 +0000 | [diff] [blame] | 392 | IPacketBufferPtr buffer = m_BufferManager.Reserve(1024, reserved); |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 393 | memcpy(buffer->GetWritableData(), message.c_str(), static_cast<unsigned int>(message.size()) + 1); |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 394 | m_BufferManager.Commit(buffer, reserved, false); |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 395 | } |
| 396 | |
Matteo Martincigh | 42f9d9e | 2019-09-05 12:02:04 +0100 | [diff] [blame] | 397 | void SendCounterDirectoryPacket(const ICounterDirectory& counterDirectory) override |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 398 | { |
Derek Lamberti | 1dd75b3 | 2019-12-10 21:23:23 +0000 | [diff] [blame] | 399 | boost::ignore_unused(counterDirectory); |
| 400 | |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 401 | std::string message("SendCounterDirectoryPacket"); |
| 402 | unsigned int reserved = 0; |
Matteo Martincigh | 2ffcc41 | 2019-11-05 11:47:40 +0000 | [diff] [blame] | 403 | IPacketBufferPtr buffer = m_BufferManager.Reserve(1024, reserved); |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 404 | memcpy(buffer->GetWritableData(), message.c_str(), static_cast<unsigned int>(message.size()) + 1); |
| 405 | m_BufferManager.Commit(buffer, reserved); |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 406 | } |
| 407 | |
| 408 | void SendPeriodicCounterCapturePacket(uint64_t timestamp, |
| 409 | const std::vector<std::pair<uint16_t, uint32_t>>& values) override |
| 410 | { |
Derek Lamberti | 1dd75b3 | 2019-12-10 21:23:23 +0000 | [diff] [blame] | 411 | boost::ignore_unused(timestamp, values); |
| 412 | |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 413 | std::string message("SendPeriodicCounterCapturePacket"); |
| 414 | unsigned int reserved = 0; |
Matteo Martincigh | 2ffcc41 | 2019-11-05 11:47:40 +0000 | [diff] [blame] | 415 | IPacketBufferPtr buffer = m_BufferManager.Reserve(1024, reserved); |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 416 | memcpy(buffer->GetWritableData(), message.c_str(), static_cast<unsigned int>(message.size()) + 1); |
| 417 | m_BufferManager.Commit(buffer, reserved); |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 418 | } |
| 419 | |
| 420 | void SendPeriodicCounterSelectionPacket(uint32_t capturePeriod, |
| 421 | const std::vector<uint16_t>& selectedCounterIds) override |
| 422 | { |
Derek Lamberti | 1dd75b3 | 2019-12-10 21:23:23 +0000 | [diff] [blame] | 423 | boost::ignore_unused(capturePeriod, selectedCounterIds); |
| 424 | |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 425 | std::string message("SendPeriodicCounterSelectionPacket"); |
| 426 | unsigned int reserved = 0; |
Matteo Martincigh | 2ffcc41 | 2019-11-05 11:47:40 +0000 | [diff] [blame] | 427 | IPacketBufferPtr buffer = m_BufferManager.Reserve(1024, reserved); |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 428 | memcpy(buffer->GetWritableData(), message.c_str(), static_cast<unsigned int>(message.size()) + 1); |
| 429 | m_BufferManager.Commit(buffer, reserved); |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 430 | } |
| 431 | |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 432 | private: |
Narumol Prangnawarat | 404b275 | 2019-09-24 17:23:16 +0100 | [diff] [blame] | 433 | IBufferManager& m_BufferManager; |
Ferran Balaguer | 1b94172 | 2019-08-28 16:57:18 +0100 | [diff] [blame] | 434 | }; |
Matteo Martincigh | 42f9d9e | 2019-09-05 12:02:04 +0100 | [diff] [blame] | 435 | |
| 436 | class MockCounterDirectory : public ICounterDirectory |
| 437 | { |
| 438 | public: |
| 439 | MockCounterDirectory() = default; |
| 440 | ~MockCounterDirectory() = default; |
| 441 | |
| 442 | // Register profiling objects |
| 443 | const Category* RegisterCategory(const std::string& categoryName, |
| 444 | const armnn::Optional<uint16_t>& deviceUid = armnn::EmptyOptional(), |
| 445 | const armnn::Optional<uint16_t>& counterSetUid = armnn::EmptyOptional()) |
| 446 | { |
| 447 | // Get the device UID |
| 448 | uint16_t deviceUidValue = deviceUid.has_value() ? deviceUid.value() : 0; |
| 449 | |
| 450 | // Get the counter set UID |
| 451 | uint16_t counterSetUidValue = counterSetUid.has_value() ? counterSetUid.value() : 0; |
| 452 | |
| 453 | // Create the category |
| 454 | CategoryPtr category = std::make_unique<Category>(categoryName, deviceUidValue, counterSetUidValue); |
| 455 | BOOST_ASSERT(category); |
| 456 | |
| 457 | // Get the raw category pointer |
| 458 | const Category* categoryPtr = category.get(); |
| 459 | BOOST_ASSERT(categoryPtr); |
| 460 | |
| 461 | // Register the category |
| 462 | m_Categories.insert(std::move(category)); |
| 463 | |
| 464 | return categoryPtr; |
| 465 | } |
| 466 | |
| 467 | const Device* RegisterDevice(const std::string& deviceName, |
| 468 | uint16_t cores = 0, |
| 469 | const armnn::Optional<std::string>& parentCategoryName = armnn::EmptyOptional()) |
| 470 | { |
| 471 | // Get the device UID |
| 472 | uint16_t deviceUid = GetNextUid(); |
| 473 | |
| 474 | // Create the device |
| 475 | DevicePtr device = std::make_unique<Device>(deviceUid, deviceName, cores); |
| 476 | BOOST_ASSERT(device); |
| 477 | |
| 478 | // Get the raw device pointer |
| 479 | const Device* devicePtr = device.get(); |
| 480 | BOOST_ASSERT(devicePtr); |
| 481 | |
| 482 | // Register the device |
| 483 | m_Devices.insert(std::make_pair(deviceUid, std::move(device))); |
| 484 | |
| 485 | // Connect the counter set to the parent category, if required |
| 486 | if (parentCategoryName.has_value()) |
| 487 | { |
| 488 | // Set the counter set UID in the parent category |
| 489 | Category* parentCategory = const_cast<Category*>(GetCategory(parentCategoryName.value())); |
| 490 | BOOST_ASSERT(parentCategory); |
| 491 | parentCategory->m_DeviceUid = deviceUid; |
| 492 | } |
| 493 | |
| 494 | return devicePtr; |
| 495 | } |
| 496 | |
| 497 | const CounterSet* RegisterCounterSet( |
| 498 | const std::string& counterSetName, |
| 499 | uint16_t count = 0, |
| 500 | const armnn::Optional<std::string>& parentCategoryName = armnn::EmptyOptional()) |
| 501 | { |
| 502 | // Get the counter set UID |
| 503 | uint16_t counterSetUid = GetNextUid(); |
| 504 | |
| 505 | // Create the counter set |
| 506 | CounterSetPtr counterSet = std::make_unique<CounterSet>(counterSetUid, counterSetName, count); |
| 507 | BOOST_ASSERT(counterSet); |
| 508 | |
| 509 | // Get the raw counter set pointer |
| 510 | const CounterSet* counterSetPtr = counterSet.get(); |
| 511 | BOOST_ASSERT(counterSetPtr); |
| 512 | |
| 513 | // Register the counter set |
| 514 | m_CounterSets.insert(std::make_pair(counterSetUid, std::move(counterSet))); |
| 515 | |
| 516 | // Connect the counter set to the parent category, if required |
| 517 | if (parentCategoryName.has_value()) |
| 518 | { |
| 519 | // Set the counter set UID in the parent category |
| 520 | Category* parentCategory = const_cast<Category*>(GetCategory(parentCategoryName.value())); |
| 521 | BOOST_ASSERT(parentCategory); |
| 522 | parentCategory->m_CounterSetUid = counterSetUid; |
| 523 | } |
| 524 | |
| 525 | return counterSetPtr; |
| 526 | } |
| 527 | |
Keith Davis | e394bd9 | 2019-12-02 15:12:19 +0000 | [diff] [blame] | 528 | const Counter* RegisterCounter(const BackendId& backendId, |
| 529 | const uint16_t uid, |
| 530 | const std::string& parentCategoryName, |
Matteo Martincigh | 42f9d9e | 2019-09-05 12:02:04 +0100 | [diff] [blame] | 531 | uint16_t counterClass, |
| 532 | uint16_t interpolation, |
| 533 | double multiplier, |
| 534 | const std::string& name, |
| 535 | const std::string& description, |
| 536 | const armnn::Optional<std::string>& units = armnn::EmptyOptional(), |
| 537 | const armnn::Optional<uint16_t>& numberOfCores = armnn::EmptyOptional(), |
| 538 | const armnn::Optional<uint16_t>& deviceUid = armnn::EmptyOptional(), |
| 539 | const armnn::Optional<uint16_t>& counterSetUid = armnn::EmptyOptional()) |
| 540 | { |
Derek Lamberti | f143fba | 2020-01-02 13:50:57 +0000 | [diff] [blame] | 541 | boost::ignore_unused(backendId); |
| 542 | |
Matteo Martincigh | 42f9d9e | 2019-09-05 12:02:04 +0100 | [diff] [blame] | 543 | // Get the number of cores from the argument only |
| 544 | uint16_t deviceCores = numberOfCores.has_value() ? numberOfCores.value() : 0; |
| 545 | |
| 546 | // Get the device UID |
| 547 | uint16_t deviceUidValue = deviceUid.has_value() ? deviceUid.value() : 0; |
| 548 | |
| 549 | // Get the counter set UID |
| 550 | uint16_t counterSetUidValue = counterSetUid.has_value() ? counterSetUid.value() : 0; |
| 551 | |
| 552 | // Get the counter UIDs and calculate the max counter UID |
Keith Davis | e394bd9 | 2019-12-02 15:12:19 +0000 | [diff] [blame] | 553 | std::vector<uint16_t> counterUids = GetNextCounterUids(uid, deviceCores); |
Matteo Martincigh | 42f9d9e | 2019-09-05 12:02:04 +0100 | [diff] [blame] | 554 | BOOST_ASSERT(!counterUids.empty()); |
| 555 | uint16_t maxCounterUid = deviceCores <= 1 ? counterUids.front() : counterUids.back(); |
| 556 | |
| 557 | // Get the counter units |
| 558 | const std::string unitsValue = units.has_value() ? units.value() : ""; |
| 559 | |
| 560 | // Create the counter |
Keith Davis | e394bd9 | 2019-12-02 15:12:19 +0000 | [diff] [blame] | 561 | CounterPtr counter = std::make_shared<Counter>(armnn::profiling::BACKEND_ID, |
| 562 | counterUids.front(), |
Matteo Martincigh | 42f9d9e | 2019-09-05 12:02:04 +0100 | [diff] [blame] | 563 | maxCounterUid, |
| 564 | counterClass, |
| 565 | interpolation, |
| 566 | multiplier, |
| 567 | name, |
| 568 | description, |
| 569 | unitsValue, |
| 570 | deviceUidValue, |
| 571 | counterSetUidValue); |
| 572 | BOOST_ASSERT(counter); |
| 573 | |
| 574 | // Get the raw counter pointer |
| 575 | const Counter* counterPtr = counter.get(); |
| 576 | BOOST_ASSERT(counterPtr); |
| 577 | |
| 578 | // Process multiple counters if necessary |
| 579 | for (uint16_t counterUid : counterUids) |
| 580 | { |
| 581 | // Connect the counter to the parent category |
| 582 | Category* parentCategory = const_cast<Category*>(GetCategory(parentCategoryName)); |
| 583 | BOOST_ASSERT(parentCategory); |
| 584 | parentCategory->m_Counters.push_back(counterUid); |
| 585 | |
| 586 | // Register the counter |
| 587 | m_Counters.insert(std::make_pair(counterUid, counter)); |
| 588 | } |
| 589 | |
| 590 | return counterPtr; |
| 591 | } |
| 592 | |
| 593 | // Getters for counts |
| 594 | uint16_t GetCategoryCount() const override { return boost::numeric_cast<uint16_t>(m_Categories.size()); } |
| 595 | uint16_t GetDeviceCount() const override { return boost::numeric_cast<uint16_t>(m_Devices.size()); } |
| 596 | uint16_t GetCounterSetCount() const override { return boost::numeric_cast<uint16_t>(m_CounterSets.size()); } |
| 597 | uint16_t GetCounterCount() const override { return boost::numeric_cast<uint16_t>(m_Counters.size()); } |
| 598 | |
| 599 | // Getters for collections |
| 600 | const Categories& GetCategories() const override { return m_Categories; } |
| 601 | const Devices& GetDevices() const override { return m_Devices; } |
| 602 | const CounterSets& GetCounterSets() const override { return m_CounterSets; } |
| 603 | const Counters& GetCounters() const override { return m_Counters; } |
| 604 | |
| 605 | // Getters for profiling objects |
| 606 | const Category* GetCategory(const std::string& name) const override |
| 607 | { |
| 608 | auto it = std::find_if(m_Categories.begin(), m_Categories.end(), [&name](const CategoryPtr& category) |
| 609 | { |
| 610 | BOOST_ASSERT(category); |
| 611 | |
| 612 | return category->m_Name == name; |
| 613 | }); |
| 614 | |
| 615 | if (it == m_Categories.end()) |
| 616 | { |
| 617 | return nullptr; |
| 618 | } |
| 619 | |
| 620 | return it->get(); |
| 621 | } |
| 622 | |
| 623 | const Device* GetDevice(uint16_t uid) const override |
| 624 | { |
Derek Lamberti | 1dd75b3 | 2019-12-10 21:23:23 +0000 | [diff] [blame] | 625 | boost::ignore_unused(uid); |
Matteo Martincigh | 42f9d9e | 2019-09-05 12:02:04 +0100 | [diff] [blame] | 626 | return nullptr; // Not used by the unit tests |
| 627 | } |
| 628 | |
| 629 | const CounterSet* GetCounterSet(uint16_t uid) const override |
| 630 | { |
Derek Lamberti | 1dd75b3 | 2019-12-10 21:23:23 +0000 | [diff] [blame] | 631 | boost::ignore_unused(uid); |
Matteo Martincigh | 42f9d9e | 2019-09-05 12:02:04 +0100 | [diff] [blame] | 632 | return nullptr; // Not used by the unit tests |
| 633 | } |
| 634 | |
| 635 | const Counter* GetCounter(uint16_t uid) const override |
| 636 | { |
Derek Lamberti | 1dd75b3 | 2019-12-10 21:23:23 +0000 | [diff] [blame] | 637 | boost::ignore_unused(uid); |
Matteo Martincigh | 42f9d9e | 2019-09-05 12:02:04 +0100 | [diff] [blame] | 638 | return nullptr; // Not used by the unit tests |
| 639 | } |
| 640 | |
| 641 | private: |
| 642 | Categories m_Categories; |
| 643 | Devices m_Devices; |
| 644 | CounterSets m_CounterSets; |
| 645 | Counters m_Counters; |
| 646 | }; |
| 647 | |
| 648 | class SendCounterPacketTest : public SendCounterPacket |
| 649 | { |
| 650 | public: |
Sadik Armagan | 3896b47 | 2020-02-10 12:24:15 +0000 | [diff] [blame^] | 651 | SendCounterPacketTest(IBufferManager& buffer) |
| 652 | : SendCounterPacket(buffer) |
Matteo Martincigh | 42f9d9e | 2019-09-05 12:02:04 +0100 | [diff] [blame] | 653 | {} |
| 654 | |
| 655 | bool CreateDeviceRecordTest(const DevicePtr& device, |
| 656 | DeviceRecord& deviceRecord, |
| 657 | std::string& errorMessage) |
| 658 | { |
| 659 | return CreateDeviceRecord(device, deviceRecord, errorMessage); |
| 660 | } |
| 661 | |
| 662 | bool CreateCounterSetRecordTest(const CounterSetPtr& counterSet, |
| 663 | CounterSetRecord& counterSetRecord, |
| 664 | std::string& errorMessage) |
| 665 | { |
| 666 | return CreateCounterSetRecord(counterSet, counterSetRecord, errorMessage); |
| 667 | } |
| 668 | |
| 669 | bool CreateEventRecordTest(const CounterPtr& counter, |
| 670 | EventRecord& eventRecord, |
| 671 | std::string& errorMessage) |
| 672 | { |
| 673 | return CreateEventRecord(counter, eventRecord, errorMessage); |
| 674 | } |
| 675 | |
| 676 | bool CreateCategoryRecordTest(const CategoryPtr& category, |
| 677 | const Counters& counters, |
| 678 | CategoryRecord& categoryRecord, |
| 679 | std::string& errorMessage) |
| 680 | { |
| 681 | return CreateCategoryRecord(category, counters, categoryRecord, errorMessage); |
| 682 | } |
| 683 | }; |
Matteo Martincigh | 24e8f92 | 2019-09-19 11:57:46 +0100 | [diff] [blame] | 684 | |
| 685 | } // namespace profiling |
| 686 | |
| 687 | } // namespace armnn |