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

Unified Diff: build/android/pylib/perf_tests_helper.py

Issue 11026040: Upstreaming latest build/android changes (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix Reboot() and upstream other android_commands.py changes Created 8 years, 2 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
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/perf_tests_helper.py
diff --git a/build/android/pylib/perf_tests_helper.py b/build/android/pylib/perf_tests_helper.py
index 19c24f3f7f55f3fb62d8af936a8f3672fcc5fd5a..c0a3ee413d80d5ed924538d1ddab86b377ea4016 100644
--- a/build/android/pylib/perf_tests_helper.py
+++ b/build/android/pylib/perf_tests_helper.py
@@ -5,6 +5,7 @@
import re
import android_commands
+import math
# Valid values of result type.
RESULT_TYPES = {'unimportant': 'RESULT ',
@@ -46,10 +47,14 @@ def PrintPerfResult(measurement, trace, values, units, result_type='default',
assert len(values)
assert '/' not in measurement
avg = None
+ sd = None
if len(values) > 1:
try:
value = '[%s]' % ','.join([str(v) for v in values])
avg = sum([float(v) for v in values]) / len(values)
+ sqdiffs = [(float(v) - avg) ** 2 for v in values]
+ variance = sum(sqdiffs) / (len(values) - 1)
+ sd = math.sqrt(variance)
except ValueError:
value = ", ".join(values)
else:
@@ -67,6 +72,8 @@ def PrintPerfResult(measurement, trace, values, units, result_type='default',
units)
if avg:
output += '\nAvg %s: %f%s' % (measurement, avg, units)
+ if sd:
+ output += '\nSd %s: %f%s' % (measurement, sd, units)
if print_to_stdout:
print output
return output
@@ -87,6 +94,9 @@ class PerfTestSetup(object):
def DropRamCaches(self):
"""Drops the filesystem ram caches for performance testing."""
+ if not self._adb.IsRootEnabled():
+ self._adb.EnableAdbRoot()
+ self._adb.RunShellCommand('sync')
self._adb.RunShellCommand('echo 3 > ' + PerfTestSetup._DROP_CACHES)
def SetUp(self):
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698