From ce58a9f8f8504c165ca4527bfd991a4029437cba Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Tue, 31 Oct 2017 17:59:17 +0000 Subject: 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 Reviewed-by: Anthony Barbier --- tests/framework/instruments/WallClockTimer.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/framework/instruments/WallClockTimer.h') diff --git a/tests/framework/instruments/WallClockTimer.h b/tests/framework/instruments/WallClockTimer.h index fd2b18c3fb..468f4d3a8f 100644 --- a/tests/framework/instruments/WallClockTimer.h +++ b/tests/framework/instruments/WallClockTimer.h @@ -38,6 +38,27 @@ namespace framework class WallClockTimer : public Instrument { public: + WallClockTimer(ScaleFactor scale_factor) + { + switch(scale_factor) + { + case ScaleFactor::NONE: + _scale_factor = 1.f; + _unit = "us"; + break; + case ScaleFactor::TIME_MS: + _scale_factor = 1000.f; + _unit = "ms"; + break; + case ScaleFactor::TIME_S: + _scale_factor = 1000000.f; + _unit = "s"; + break; + default: + ARM_COMPUTE_ERROR("Invalid scale"); + } + }; + std::string id() const override; void start() override; void stop() override; @@ -46,6 +67,7 @@ public: private: std::chrono::high_resolution_clock::time_point _start{}; std::chrono::high_resolution_clock::time_point _stop{}; + float _scale_factor{}; }; } // namespace framework } // namespace test -- cgit v1.2.1