aboutsummaryrefslogtreecommitdiff
path: root/tests/framework/instruments/Instruments.h
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2017-10-31 17:59:17 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commitce58a9f8f8504c165ca4527bfd991a4029437cba (patch)
treec4360d11603912aa2e1915e5c25e42062218aaa5 /tests/framework/instruments/Instruments.h
parent82afedf2598c8fc5a428ecbd729dd8204b46fd43 (diff)
downloadComputeLibrary-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/Instruments.h')
-rw-r--r--tests/framework/instruments/Instruments.h73
1 files changed, 65 insertions, 8 deletions
diff --git a/tests/framework/instruments/Instruments.h b/tests/framework/instruments/Instruments.h
index ffe7cb681d..651f0f567e 100644
--- a/tests/framework/instruments/Instruments.h
+++ b/tests/framework/instruments/Instruments.h
@@ -50,9 +50,11 @@ enum class InstrumentType : unsigned int
OPENCL_TIMER = 0x0400,
};
-InstrumentType instrument_type_from_name(const std::string &name);
+using InstrumentsDescription = std::pair<InstrumentType, ScaleFactor>;
-inline ::std::stringstream &operator>>(::std::stringstream &stream, InstrumentType &instrument)
+InstrumentsDescription instrument_type_from_name(const std::string &name);
+
+inline ::std::stringstream &operator>>(::std::stringstream &stream, InstrumentsDescription &instrument)
{
std::string value;
stream >> value;
@@ -60,15 +62,41 @@ inline ::std::stringstream &operator>>(::std::stringstream &stream, InstrumentTy
return stream;
}
-inline ::std::stringstream &operator<<(::std::stringstream &stream, InstrumentType instrument)
+inline ::std::stringstream &operator<<(::std::stringstream &stream, InstrumentsDescription instrument)
{
- switch(instrument)
+ switch(instrument.first)
{
case InstrumentType::WALL_CLOCK_TIMER:
- stream << "WALL_CLOCK_TIMER";
+ switch(instrument.second)
+ {
+ case ScaleFactor::NONE:
+ stream << "WALL_CLOCK_TIMER";
+ break;
+ case ScaleFactor::TIME_MS:
+ stream << "WALL_CLOCK_TIMER_MS";
+ break;
+ case ScaleFactor::TIME_S:
+ stream << "WALL_CLOCK_TIMER_S";
+ break;
+ default:
+ throw std::invalid_argument("Unsupported instrument scale");
+ }
break;
case InstrumentType::PMU:
- stream << "PMU";
+ switch(instrument.second)
+ {
+ case ScaleFactor::NONE:
+ stream << "PMU";
+ break;
+ case ScaleFactor::SCALE_1K:
+ stream << "PMU_K";
+ break;
+ case ScaleFactor::SCALE_1M:
+ stream << "PMU_M";
+ break;
+ default:
+ throw std::invalid_argument("Unsupported instrument scale");
+ }
break;
case InstrumentType::PMU_CYCLE_COUNTER:
stream << "PMU_CYCLE_COUNTER";
@@ -77,10 +105,39 @@ inline ::std::stringstream &operator<<(::std::stringstream &stream, InstrumentTy
stream << "PMU_INSTRUCTION_COUNTER";
break;
case InstrumentType::MALI:
- stream << "MALI";
+ switch(instrument.second)
+ {
+ case ScaleFactor::NONE:
+ stream << "MALI";
+ break;
+ case ScaleFactor::SCALE_1K:
+ stream << "MALI_K";
+ break;
+ case ScaleFactor::SCALE_1M:
+ stream << "MALI_M";
+ break;
+ default:
+ throw std::invalid_argument("Unsupported instrument scale");
+ }
break;
case InstrumentType::OPENCL_TIMER:
- stream << "OPENCL_TIMER";
+ switch(instrument.second)
+ {
+ case ScaleFactor::NONE:
+ stream << "OPENCL_TIMER";
+ break;
+ case ScaleFactor::TIME_US:
+ stream << "OPENCL_TIMER_US";
+ break;
+ case ScaleFactor::TIME_MS:
+ stream << "OPENCL_TIMER_MS";
+ break;
+ case ScaleFactor::TIME_S:
+ stream << "OPENCL_TIMER_S";
+ break;
+ default:
+ throw std::invalid_argument("Unsupported instrument scale");
+ }
break;
case InstrumentType::ALL:
stream << "ALL";