ArmNN
 22.02
IBackendProfiling.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <armnn/IRuntime.hpp>
9 
10 #include <common/include/IProfilingGuidGenerator.hpp>
11 
12 #include <memory>
13 #include <vector>
14 
15 namespace armnn
16 {
17 
18 namespace profiling
19 {
20 
22 {
23  CounterValue(uint16_t id, uint32_t value) :
24  counterId(id), counterValue(value) {}
25  uint16_t counterId;
26  uint32_t counterValue;
27 };
28 
29 struct Timestamp
30 {
31  uint64_t timestamp;
32  std::vector<CounterValue> counterValues;
33 };
34 
36 {
37  CounterStatus(uint16_t backendCounterId,
38  uint16_t globalCounterId,
39  bool enabled,
40  uint32_t samplingRateInMicroseconds)
41  : m_BackendCounterId(backendCounterId),
42  m_GlobalCounterId(globalCounterId),
43  m_Enabled(enabled),
44  m_SamplingRateInMicroseconds(samplingRateInMicroseconds) {}
47  bool m_Enabled;
49 };
50 
52 {
53 public:
54  virtual void RegisterCategory(const std::string& categoryName) = 0;
55 
56  virtual uint16_t RegisterDevice(const std::string& deviceName,
57  uint16_t cores = 0,
58  const Optional<std::string>& parentCategoryName = EmptyOptional()) = 0;
59 
60  virtual uint16_t RegisterCounterSet(const std::string& counterSetName,
61  uint16_t count = 0,
62  const Optional<std::string>& parentCategoryName = EmptyOptional()) = 0;
63 
64  virtual uint16_t RegisterCounter(const uint16_t uid,
65  const std::string& parentCategoryName,
66  uint16_t counterClass,
67  uint16_t interpolation,
68  double multiplier,
69  const std::string& name,
70  const std::string& description,
71  const Optional<std::string>& units = EmptyOptional(),
72  const Optional<uint16_t>& numberOfCores = EmptyOptional(),
73  const Optional<uint16_t>& deviceUid = EmptyOptional(),
74  const Optional<uint16_t>& counterSetUid = EmptyOptional()) = 0;
75 
77 };
78 
80 {
81 public:
83  {}
84 
85  virtual std::unique_ptr<IRegisterBackendCounters>
86  GetCounterRegistrationInterface(uint16_t currentMaxGlobalCounterID) = 0;
87 
88  virtual std::unique_ptr<ISendTimelinePacket> GetSendTimelinePacket() = 0;
89 
90  virtual IProfilingGuidGenerator& GetProfilingGuidGenerator() = 0;
91 
92  virtual void ReportCounters(const std::vector<Timestamp>& counterValues) = 0;
93 
94  virtual CounterStatus GetCounterStatus(uint16_t backendCounterId) = 0;
95 
96  virtual std::vector<CounterStatus> GetActiveCounters() = 0;
97 
98  virtual bool IsProfilingEnabled() const = 0;
99 
100 };
101 
102 } // namespace profiling
103 
104 } // namespace armnn
CounterValue(uint16_t id, uint32_t value)
Copyright (c) 2021 ARM Limited and Contributors.
CounterStatus(uint16_t backendCounterId, uint16_t globalCounterId, bool enabled, uint32_t samplingRateInMicroseconds)
std::vector< CounterValue > counterValues
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...
Definition: Optional.hpp:32