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

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

Issue 17390017: Allow for lists of lists when summarizing performance results (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix inconsistent plural in comment Created 7 years, 6 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 | « no previous file | 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 e510eb40d64d1abe3e47472c1c84b20d3f47ef97..7bb002ed06daf19457248010b7a59b8ca8138b73 100644
--- a/build/android/pylib/perf_tests_helper.py
+++ b/build/android/pylib/perf_tests_helper.py
@@ -23,6 +23,17 @@ def _EscapePerfResult(s):
return re.sub('[\:|=/#&,]', '_', s)
+def _Flatten(values):
+ """Returns a simple list without sub-lists."""
+ ret = []
+ for entry in values:
+ if isinstance(entry, list):
+ ret.extend(_Flatten(entry))
+ else:
+ ret.append(entry)
+ return ret
+
+
def GeomMeanAndStdDevFromHistogram(histogram_json):
histogram = json.loads(histogram_json)
# Handle empty histograms gracefully.
@@ -82,7 +93,8 @@ def PrintPerfResult(measurement, trace, values, units, result_type='default',
Args:
measurement: A description of the quantity being measured, e.g. "vm_peak".
trace: A description of the particular data point, e.g. "reference".
- values: A list of numeric measured values.
+ values: A list of numeric measured values. An N-dimensional list will be
+ flattened and treated as a simple list.
units: A description of the units of measure, e.g. "bytes".
result_type: Accepts values of RESULT_TYPES.
print_to_stdout: If True, prints the output in stdout instead of returning
@@ -99,7 +111,7 @@ def PrintPerfResult(measurement, trace, values, units, result_type='default',
assert isinstance(values, list)
assert len(values)
assert '/' not in measurement
- value, avg, sd = _MeanAndStdDevFromList(values)
+ value, avg, sd = _MeanAndStdDevFromList(_Flatten(values))
output = '%s%s: %s%s%s %s' % (
RESULT_TYPES[result_type],
_EscapePerfResult(measurement),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698