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 | |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 23 | RegisterBackendCounters( |
| 24 | uint16_t currentMaxGlobalCounterID, const BackendId& backendId, ProfilingService& profilingService) |
| 25 | : m_CurrentMaxGlobalCounterID(currentMaxGlobalCounterID), |
| 26 | m_BackendId(backendId), |
| 27 | m_ProfilingService(profilingService), |
| 28 | m_CounterDirectory(m_ProfilingService.GetCounterRegistry()) {} |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 29 | |
| 30 | ~RegisterBackendCounters() = default; |
| 31 | |
Sadik Armagan | 4c99899 | 2020-02-25 12:44:44 +0000 | [diff] [blame] | 32 | void RegisterCategory(const std::string& categoryName) override; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 33 | |
| 34 | uint16_t RegisterDevice(const std::string& deviceName, |
| 35 | uint16_t cores = 0, |
| 36 | const Optional<std::string>& parentCategoryName = EmptyOptional()) override; |
| 37 | |
| 38 | uint16_t RegisterCounterSet(const std::string& counterSetName, |
| 39 | uint16_t count = 0, |
| 40 | const Optional<std::string>& parentCategoryName = EmptyOptional()) override; |
| 41 | |
| 42 | uint16_t RegisterCounter(const uint16_t uid, |
| 43 | const std::string& parentCategoryName, |
| 44 | uint16_t counterClass, |
| 45 | uint16_t interpolation, |
| 46 | double multiplier, |
| 47 | const std::string& name, |
| 48 | const std::string& description, |
| 49 | const Optional<std::string>& units = EmptyOptional(), |
| 50 | const Optional<uint16_t>& numberOfCores = EmptyOptional(), |
| 51 | const Optional<uint16_t>& deviceUid = EmptyOptional(), |
| 52 | const Optional<uint16_t>& counterSetUid = EmptyOptional()) override; |
| 53 | |
| 54 | private: |
| 55 | uint16_t m_CurrentMaxGlobalCounterID; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 56 | const BackendId& m_BackendId; |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 57 | ProfilingService& m_ProfilingService; |
| 58 | ICounterRegistry& m_CounterDirectory; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | } // namespace profiling |
| 62 | |
| 63 | } // namespace armnn |