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>
diff --git a/tests/framework/instruments/Instruments.h b/tests/framework/instruments/Instruments.h
index ffe7cb6..651f0f5 100644
--- a/tests/framework/instruments/Instruments.h
+++ b/tests/framework/instruments/Instruments.h
@@ -50,9 +50,11 @@
     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 @@
     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 @@
             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";