Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: tools/telemetry/telemetry/core/platform/profiler/monsoon_profiler.py

Issue 185953004: Add some statistics to the monsoon profile run (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rebase and provide own statistics functions Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698