diff options
Diffstat (limited to 'src/armnn/Instrument.hpp')
-rw-r--r-- | src/armnn/Instrument.hpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/armnn/Instrument.hpp b/src/armnn/Instrument.hpp new file mode 100644 index 0000000000..8d3ac5a76c --- /dev/null +++ b/src/armnn/Instrument.hpp @@ -0,0 +1,66 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#pragma once + +#include <string> +#include <vector> + +namespace armnn +{ + +struct Measurement +{ + enum Unit + { + TIME_NS, + TIME_US, + TIME_MS, + }; + + inline static const char* ToString(Unit unit) + { + switch (unit) + { + case TIME_NS: return "ns"; + case TIME_US: return "us"; + case TIME_MS: return "ms"; + default: return ""; + } + } + + Measurement(const std::string& name, double value, Unit unit) + : m_Name(name) + , m_Value(value) + , m_Unit(unit) + {} + Measurement(const Measurement&) = default; + ~Measurement() = default; + + std::string m_Name; + double m_Value; + Unit m_Unit; + +private: + // please don't default construct, otherwise Units will be wrong + Measurement() = delete; +}; + +class Instrument +{ +public: + virtual ~Instrument() {} + + virtual void Start() = 0; + + virtual void Stop() = 0; + + virtual std::vector<Measurement> GetMeasurements() const = 0; + + virtual const char* GetName() const = 0; + +}; + +} //namespace armnn |