Chromium Code Reviews| 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..1b74f912d04acfa98d694537e7229b584891469e 100644 |
| --- a/tools/telemetry/telemetry/core/platform/profiler/monsoon_profiler.py |
| +++ b/tools/telemetry/telemetry/core/platform/profiler/monsoon_profiler.py |
| @@ -11,10 +11,10 @@ Output graph plots power in watts over time in seconds. |
| import csv |
| 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 +49,16 @@ def _CollectData(output_path, is_collecting): |
| output_writer.writerows(plot_data) |
| output_file.flush() |
| + power = [] |
| + for sample in samples: |
| + power.append(sample.amps * sample.volts) |
|
tonyg
2014/03/12 15:28:38
Neat pythonism:
power_samples = [s.amps * s.volts
|
| + |
| + print ('Power total=%f' % statistics.TrapezoidalRule(power, 1/5000.) + |
|
tonyg
2014/03/12 15:28:38
I'm wondering whether the labels would be better a
|
| + ' average=%f' % statistics.ArithmeticMean(power) + |
| + '+-%f' % statistics.StandardDeviation(power) + |
| + ' peak=%f' % max(power) + |
| + ' time=%f' % (len(power) / 5000.)) |
| + |
| print 'To view the Monsoon profile, run:' |
| print (' echo "set datafile separator \',\'; plot \'%s\' with lines" | ' |
| 'gnuplot --persist' % output_path) |