diff options
author | Giorgio Arena <giorgio.arena@arm.com> | 2017-10-31 17:59:17 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | ce58a9f8f8504c165ca4527bfd991a4029437cba (patch) | |
tree | c4360d11603912aa2e1915e5c25e42062218aaa5 /tests/framework/instruments/Instrument.h | |
parent | 82afedf2598c8fc5a428ecbd729dd8204b46fd43 (diff) | |
download | ComputeLibrary-ce58a9f8f8504c165ca4527bfd991a4029437cba.tar.gz |
COMPMID-622 Let the user choose the units for the instruments
Change-Id: Ic6ac4cd6df6970593a5e2e6310b6d61951c88898
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/93887
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/framework/instruments/Instrument.h')
-rw-r--r-- | tests/framework/instruments/Instrument.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/framework/instruments/Instrument.h b/tests/framework/instruments/Instrument.h index 560bdf6a35..9156d70010 100644 --- a/tests/framework/instruments/Instrument.h +++ b/tests/framework/instruments/Instrument.h @@ -37,6 +37,15 @@ namespace test { namespace framework { +enum class ScaleFactor : unsigned int +{ + NONE, /* Default scale */ + SCALE_1K, /* 1000 */ + SCALE_1M, /* 1 000 000 */ + TIME_US, /* Microseconds */ + TIME_MS, /* Milliseconds */ + TIME_S, /* Seconds */ +}; /** Interface for classes that can be used to measure performance. */ class Instrument { @@ -45,10 +54,11 @@ public: * * @return Instance of an instrument of the given type. */ - template <typename T> + template <typename T, ScaleFactor scale> static std::unique_ptr<Instrument> make_instrument(); - Instrument() = default; + Instrument() = default; + Instrument(const Instrument &) = default; Instrument(Instrument &&) = default; Instrument &operator=(const Instrument &) = default; @@ -68,12 +78,15 @@ public: /** Return the latest measurement. */ virtual MeasurementsMap measurements() const = 0; + +protected: + std::string _unit{}; }; -template <typename T> +template <typename T, ScaleFactor scale> inline std::unique_ptr<Instrument> Instrument::make_instrument() { - return support::cpp14::make_unique<T>(); + return support::cpp14::make_unique<T>(scale); } } // namespace framework } // namespace test |