ArmNN
 20.11
Instrument.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <string>
9 #include <vector>
10 
11 namespace armnn
12 {
13 
15 {
16  enum Unit
17  {
21  };
22 
23  inline static const char* ToString(Unit unit)
24  {
25  switch (unit)
26  {
27  case TIME_NS: return "ns";
28  case TIME_US: return "us";
29  case TIME_MS: return "ms";
30  default: return "";
31  }
32  }
33 
34  Measurement(const std::string& name, double value, Unit unit)
35  : m_Name(name)
36  , m_Value(value)
37  , m_Unit(unit)
38  {}
39  Measurement(const Measurement&) = default;
40  ~Measurement() = default;
41 
42  std::string m_Name;
43  double m_Value;
45 
46 private:
47  // please don't default construct, otherwise Units will be wrong
48  Measurement() = delete;
49 };
50 
52 {
53 public:
54  virtual ~Instrument() {}
55 
56  virtual void Start() = 0;
57 
58  virtual void Stop() = 0;
59 
60  virtual std::vector<Measurement> GetMeasurements() const = 0;
61 
62  virtual const char* GetName() const = 0;
63 
64 };
65 
66 } //namespace armnn
static const char * ToString(Unit unit)
Definition: Instrument.hpp:23
std::string m_Name
Definition: Instrument.hpp:42
Copyright (c) 2020 ARM Limited.
Measurement(const std::string &name, double value, Unit unit)
Definition: Instrument.hpp:34
virtual ~Instrument()
Definition: Instrument.hpp:54
~Measurement()=default