Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include "armnn/backends/profiling/IBackendProfiling.hpp" |
| 9 | #include "CounterIdMap.hpp" |
| 10 | #include "CounterDirectory.hpp" |
| 11 | #include "ProfilingService.hpp" |
| 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | namespace profiling |
| 17 | { |
| 18 | |
| 19 | class RegisterBackendCounters : public IRegisterBackendCounters |
| 20 | { |
| 21 | public: |
| 22 | |
| 23 | RegisterBackendCounters(uint16_t currentMaxGlobalCounterID, const BackendId& backendId) |
| 24 | : m_CurrentMaxGlobalCounterID(currentMaxGlobalCounterID), |
| 25 | m_CounterDirectory(ProfilingService::Instance().GetCounterRegistry()), |
| 26 | m_BackendId(backendId) {} |
| 27 | |
| 28 | ~RegisterBackendCounters() = default; |
| 29 | |
Sadik Armagan | 4c99899 | 2020-02-25 12:44:44 +0000 | [diff] [blame] | 30 | void RegisterCategory(const std::string& categoryName) override; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 31 | |
| 32 | uint16_t RegisterDevice(const std::string& deviceName, |
| 33 | uint16_t cores = 0, |
| 34 | const Optional<std::string>& parentCategoryName = EmptyOptional()) override; |
| 35 | |
| 36 | uint16_t RegisterCounterSet(const std::string& counterSetName, |
| 37 | uint16_t count = 0, |
| 38 | const Optional<std::string>& parentCategoryName = EmptyOptional()) override; |
| 39 | |
| 40 | uint16_t RegisterCounter(const uint16_t uid, |
| 41 | const std::string& parentCategoryName, |
| 42 | uint16_t counterClass, |
| 43 | uint16_t interpolation, |
| 44 | double multiplier, |
| 45 | const std::string& name, |
| 46 | const std::string& description, |
| 47 | const Optional<std::string>& units = EmptyOptional(), |
| 48 | const Optional<uint16_t>& numberOfCores = EmptyOptional(), |
| 49 | const Optional<uint16_t>& deviceUid = EmptyOptional(), |
| 50 | const Optional<uint16_t>& counterSetUid = EmptyOptional()) override; |
| 51 | |
| 52 | private: |
| 53 | uint16_t m_CurrentMaxGlobalCounterID; |
| 54 | ICounterRegistry& m_CounterDirectory; |
| 55 | const BackendId& m_BackendId; |
| 56 | }; |
| 57 | |
| 58 | } // namespace profiling |
| 59 | |
| 60 | } // namespace armnn |