diff options
Diffstat (limited to 'tests/framework/instruments/Instruments.h')
-rw-r--r-- | tests/framework/instruments/Instruments.h | 73 |
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"; |