• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2020 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <client/include/CounterIdMap.hpp>
9 #include <client/include/IProfilingService.hpp>
10 
11 #include <client/include/backends/IBackendProfiling.hpp>
12 
13 #include <common/include/CounterDirectory.hpp>
14 
15 namespace arm
16 {
17 
18 namespace pipe
19 {
20 
21 class RegisterBackendCounters : public IRegisterBackendCounters
22 {
23 public:
24 
RegisterBackendCounters(uint16_t currentMaxGlobalCounterID,const std::string & backendId,IProfilingService & profilingService)25     RegisterBackendCounters(
26         uint16_t currentMaxGlobalCounterID, const std::string& backendId, IProfilingService& profilingService)
27         : m_CurrentMaxGlobalCounterID(currentMaxGlobalCounterID),
28           m_BackendId(backendId),
29           m_ProfilingService(profilingService),
30           m_CounterDirectory(m_ProfilingService.GetCounterRegistry()) {}
31 
32     ~RegisterBackendCounters() = default;
33 
34     void RegisterCategory(const std::string& categoryName) override;
35 
36     uint16_t RegisterDevice(const std::string& deviceName,
37                             uint16_t cores = 0,
38                             const arm::pipe::Optional<std::string>& parentCategoryName =
39                                 arm::pipe::EmptyOptional()) override;
40 
41     uint16_t RegisterCounterSet(const std::string& counterSetName,
42                                 uint16_t count = 0,
43                                 const arm::pipe::Optional<std::string>& parentCategoryName
44                                     = arm::pipe::EmptyOptional()) override;
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,
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;
57 
58 private:
59     uint16_t m_CurrentMaxGlobalCounterID;
60     const std::string& m_BackendId;
61     IProfilingService& m_ProfilingService;
62     ICounterRegistry& m_CounterDirectory;
63 };
64 
65 } // namespace pipe
66 
67 } // namespace arm
68