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" |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 11 | #include "IProfilingService.hpp" |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 12 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 13 | namespace arm |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 14 | { |
| 15 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 16 | namespace pipe |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 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( |
Cathal Corbett | 6f07372 | 2022-03-04 12:11:09 +0000 | [diff] [blame] | 24 | uint16_t currentMaxGlobalCounterID, const std::string& backendId, IProfilingService& profilingService) |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 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, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame^] | 36 | const arm::pipe::Optional<std::string>& parentCategoryName = |
| 37 | arm::pipe::EmptyOptional()) override; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 38 | |
| 39 | uint16_t RegisterCounterSet(const std::string& counterSetName, |
| 40 | uint16_t count = 0, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame^] | 41 | const arm::pipe::Optional<std::string>& parentCategoryName |
| 42 | = arm::pipe::EmptyOptional()) override; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 43 | |
| 44 | uint16_t RegisterCounter(const uint16_t uid, |
| 45 | const std::string& parentCategoryName, |
| 46 | uint16_t counterClass, |
| 47 | uint16_t interpolation, |
| 48 | double multiplier, |
| 49 | const std::string& name, |
| 50 | const std::string& description, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame^] | 51 | const arm::pipe::Optional<std::string>& units = arm::pipe::EmptyOptional(), |
| 52 | const arm::pipe::Optional<uint16_t>& numberOfCores = arm::pipe::EmptyOptional(), |
| 53 | const arm::pipe::Optional<uint16_t>& deviceUid = arm::pipe::EmptyOptional(), |
| 54 | const arm::pipe::Optional<uint16_t>& counterSetUid = arm::pipe::EmptyOptional()) override; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 55 | |
| 56 | private: |
| 57 | uint16_t m_CurrentMaxGlobalCounterID; |
Cathal Corbett | 6f07372 | 2022-03-04 12:11:09 +0000 | [diff] [blame] | 58 | const std::string& m_BackendId; |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 59 | IProfilingService& m_ProfilingService; |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 60 | ICounterRegistry& m_CounterDirectory; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 63 | } // namespace pipe |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 64 | |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 65 | } // namespace arm |