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 | |
Jim Flynn | 2776183 | 2022-03-20 21:52:17 +0000 | [diff] [blame] | 8 | #include <client/include/CounterIdMap.hpp> |
| 9 | #include <client/include/IProfilingService.hpp> |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 10 | |
Jim Flynn | 2776183 | 2022-03-20 21:52:17 +0000 | [diff] [blame] | 11 | #include <client/include/backends/IBackendProfiling.hpp> |
Jim Flynn | c454ac9 | 2022-03-16 18:43:18 +0000 | [diff] [blame] | 12 | |
| 13 | #include <common/include/CounterDirectory.hpp> |
| 14 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 15 | namespace arm |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 16 | { |
| 17 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 18 | namespace pipe |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 19 | { |
| 20 | |
| 21 | class RegisterBackendCounters : public IRegisterBackendCounters |
| 22 | { |
| 23 | public: |
| 24 | |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 25 | RegisterBackendCounters( |
Cathal Corbett | 6f07372 | 2022-03-04 12:11:09 +0000 | [diff] [blame] | 26 | uint16_t currentMaxGlobalCounterID, const std::string& backendId, IProfilingService& profilingService) |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 27 | : m_CurrentMaxGlobalCounterID(currentMaxGlobalCounterID), |
| 28 | m_BackendId(backendId), |
| 29 | m_ProfilingService(profilingService), |
| 30 | m_CounterDirectory(m_ProfilingService.GetCounterRegistry()) {} |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 31 | |
| 32 | ~RegisterBackendCounters() = default; |
| 33 | |
Sadik Armagan | 4c99899 | 2020-02-25 12:44:44 +0000 | [diff] [blame] | 34 | void RegisterCategory(const std::string& categoryName) override; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 35 | |
| 36 | uint16_t RegisterDevice(const std::string& deviceName, |
| 37 | uint16_t cores = 0, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 38 | const arm::pipe::Optional<std::string>& parentCategoryName = |
| 39 | arm::pipe::EmptyOptional()) override; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 40 | |
| 41 | uint16_t RegisterCounterSet(const std::string& counterSetName, |
| 42 | uint16_t count = 0, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 43 | const arm::pipe::Optional<std::string>& parentCategoryName |
| 44 | = arm::pipe::EmptyOptional()) override; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 45 | |
| 46 | uint16_t RegisterCounter(const uint16_t uid, |
| 47 | const std::string& parentCategoryName, |
| 48 | uint16_t counterClass, |
| 49 | uint16_t interpolation, |
| 50 | double multiplier, |
| 51 | const std::string& name, |
| 52 | const std::string& description, |
Jim Flynn | decd08b | 2022-03-13 22:35:46 +0000 | [diff] [blame] | 53 | const arm::pipe::Optional<std::string>& units = arm::pipe::EmptyOptional(), |
| 54 | const arm::pipe::Optional<uint16_t>& numberOfCores = arm::pipe::EmptyOptional(), |
| 55 | const arm::pipe::Optional<uint16_t>& deviceUid = arm::pipe::EmptyOptional(), |
| 56 | const arm::pipe::Optional<uint16_t>& counterSetUid = arm::pipe::EmptyOptional()) override; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 57 | |
| 58 | private: |
| 59 | uint16_t m_CurrentMaxGlobalCounterID; |
Cathal Corbett | 6f07372 | 2022-03-04 12:11:09 +0000 | [diff] [blame] | 60 | const std::string& m_BackendId; |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 61 | IProfilingService& m_ProfilingService; |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 62 | ICounterRegistry& m_CounterDirectory; |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
Cathal Corbett | 5aa9fd7 | 2022-02-25 15:33:28 +0000 | [diff] [blame] | 65 | } // namespace pipe |
Jim Flynn | 9789702 | 2020-02-02 12:52:59 +0000 | [diff] [blame] | 66 | |
Jim Flynn | af94772 | 2022-03-02 11:04:47 +0000 | [diff] [blame] | 67 | } // namespace arm |