ArmNN
 20.08
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>
10 #include <memory>
11 #include <vector>
12 
13 namespace armnn
14 {
15 
16 namespace profiling
17 {
18 
20 {
21  CounterValue(uint16_t id, uint32_t value) :
22  counterId(id), counterValue(value) {}
23  uint16_t counterId;
24  uint32_t counterValue;
25 };
26 
27 struct Timestamp
28 {
29  uint64_t timestamp;
30  std::vector<CounterValue> counterValues;
31 };
32 
34 {
35  CounterStatus(uint16_t backendCounterId,
36  uint16_t globalCounterId,
37  bool enabled,
38  uint32_t samplingRateInMicroseconds)
39  : m_BackendCounterId(backendCounterId),
40  m_GlobalCounterId(globalCounterId),
41  m_Enabled(enabled),
42  m_SamplingRateInMicroseconds(samplingRateInMicroseconds) {}
45  bool m_Enabled;
47 };
48 
50 {
51 public:
52  virtual void RegisterCategory(const std::string& categoryName) = 0;
53 
54  virtual uint16_t RegisterDevice(const std::string& deviceName,
55  uint16_t cores = 0,
56  const Optional<std::string>& parentCategoryName = EmptyOptional()) = 0;
57 
58  virtual uint16_t RegisterCounterSet(const std::string& counterSetName,
59  uint16_t count = 0,
60  const Optional<std::string>& parentCategoryName = EmptyOptional()) = 0;
61 
62  virtual uint16_t RegisterCounter(const uint16_t uid,
63  const std::string& parentCategoryName,
64  uint16_t counterClass,
65  uint16_t interpolation,
66  double multiplier,
67  const std::string& name,
68  const std::string& description,
69  const Optional<std::string>& units = EmptyOptional(),
70  const Optional<uint16_t>& numberOfCores = EmptyOptional(),
71  const Optional<uint16_t>& deviceUid = EmptyOptional(),
72  const Optional<uint16_t>& counterSetUid = EmptyOptional()) = 0;
73 
75 };
76 
78 {
79 public:
81  {}
82 
83  virtual std::unique_ptr<IRegisterBackendCounters>
84  GetCounterRegistrationInterface(uint16_t currentMaxGlobalCounterID) = 0;
85 
86  virtual std::unique_ptr<ISendTimelinePacket> GetSendTimelinePacket() = 0;
87 
88  virtual IProfilingGuidGenerator& GetProfilingGuidGenerator() = 0;
89 
90  virtual void ReportCounters(const std::vector<Timestamp>& counterValues) = 0;
91 
92  virtual CounterStatus GetCounterStatus(uint16_t backendCounterId) = 0;
93 
94  virtual std::vector<CounterStatus> GetActiveCounters() = 0;
95 
96  virtual bool IsProfilingEnabled() const = 0;
97 
98 };
99 
100 } // namespace profiling
101 
102 } // namespace armnn
CounterValue(uint16_t id, uint32_t value)
Copyright (c) 2020 ARM Limited.
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