Index: tools/telemetry/telemetry/core/platform/profiler/monsoon_profiler.py |
diff --git a/tools/telemetry/telemetry/core/platform/profiler/monsoon_profiler.py b/tools/telemetry/telemetry/core/platform/profiler/monsoon_profiler.py |
index 54bb3dc83286d5b1ee602b16a6c17bd3584006fd..0ee10c730fbac0341f4542323bd09bd1286bf180 100644 |
--- a/tools/telemetry/telemetry/core/platform/profiler/monsoon_profiler.py |
+++ b/tools/telemetry/telemetry/core/platform/profiler/monsoon_profiler.py |
@@ -15,6 +15,7 @@ import multiprocessing |
from telemetry.core import exceptions |
from telemetry.core.platform import profiler |
from telemetry.core.platform.profiler import monsoon |
+from telemetry.util import statistics |
def _CollectData(output_path, is_collecting): |
@@ -49,6 +50,15 @@ def _CollectData(output_path, is_collecting): |
output_writer.writerows(plot_data) |
output_file.flush() |
+ power_samples = [s.amps * s.volts for s in samples] |
+ |
+ print 'Monsoon profile power readings in watts:' |
+ print (' Total = %f' % statistics.TrapezoidalRule(power_samples, 1/5000.)) |
+ print (' Average = %f' % statistics.ArithmeticMean(power_samples) + |
+ '+-%f' % statistics.StandardDeviation(power_samples)) |
+ print (' Peak = %f' % max(power_samples)) |
+ print (' Duration = %f' % (len(power_samples) / 5000.)) |
+ |
print 'To view the Monsoon profile, run:' |
print (' echo "set datafile separator \',\'; plot \'%s\' with lines" | ' |
'gnuplot --persist' % output_path) |