diff options
author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-23 10:36:19 +0000 |
---|---|---|
committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-23 10:36:19 +0000 |
commit | 631b806b624cd798ed2f72de739bc3e97716d08e (patch) | |
tree | 9e0d6550c216d46c218621e62f77f850931c79e5 /build/android | |
parent | 6a504ee4689dbfc327c7950a3fdd3417b7a1f6cf (diff) | |
download | chromium_src-631b806b624cd798ed2f72de739bc3e97716d08e.zip chromium_src-631b806b624cd798ed2f72de739bc3e97716d08e.tar.gz chromium_src-631b806b624cd798ed2f72de739bc3e97716d08e.tar.bz2 |
Fix histogram printing for Telemetry tests.
The previous version was printing out only the first histogram.
BUG=
Review URL: https://codereview.chromium.org/11413144
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169327 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android')
-rw-r--r-- | build/android/pylib/perf_tests_helper.py | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/build/android/pylib/perf_tests_helper.py b/build/android/pylib/perf_tests_helper.py index e09221b..ad328c214 100644 --- a/build/android/pylib/perf_tests_helper.py +++ b/build/android/pylib/perf_tests_helper.py @@ -61,6 +61,7 @@ def _MeanAndStdDevFromList(values): value = ", ".join(values) else: value = values[0] + avg = values[0] return value, avg, sd @@ -76,9 +77,7 @@ def PrintPerfResult(measurement, trace, values, units, result_type='default', trace: A description of the particular data point, e.g. "reference". values: A list of numeric measured values. units: A description of the units of measure, e.g. "bytes". - result_type: A tri-state that accepts values of ['unimportant', 'default', - 'informational']. 'unimportant' prints RESULT, 'default' prints *RESULT - and 'informational' prints nothing. + result_type: Accepts values of RESULT_TYPES. print_to_stdout: If True, prints the output in stdout instead of returning the output to caller. @@ -87,28 +86,43 @@ def PrintPerfResult(measurement, trace, values, units, result_type='default', """ assert result_type in RESULT_TYPES, 'result type: %s is invalid' % result_type + trace_name = _EscapePerfResult(trace) + if result_type in ['unimportant', 'default', 'informational']: assert isinstance(values, list) assert len(values) assert '/' not in measurement value, avg, sd = _MeanAndStdDevFromList(values) + output = '%s%s: %s%s%s %s' % ( + RESULT_TYPES[result_type], + _EscapePerfResult(measurement), + trace_name, + # Do not show equal sign if the trace is empty. Usually it happens when + # measurement is enough clear to describe the result. + '= ' if trace_name else '', + value, + units) else: - value = values[0] - # We can't print the units, otherwise parsing the histogram json output - # can't be parsed easily. - units = '' - avg, sd = GeomMeanAndStdDevFromHistogram(value) + assert(result_type in ['histogram', 'unimportant-histogram']) + assert isinstance(values, list) + assert len(values) + # Print out each histogram separately. We can't print the units, otherwise + # the histogram json output can't be parsed easily. + output = '' + ix = 1 + for value in values: + name = '%s.%s_%d' % (_EscapePerfResult(measurement), trace_name, ix) + output += '%s%s%s : %s = %s' % ( + '\n' if ix > 1 else '', + RESULT_TYPES[result_type], + name, + name, + value) + ix += 1 + measurement = '%s.%s' % (measurement, trace_name) + means_and_sds = [GeomMeanAndStdDevFromHistogram(value) for value in values] + _, avg, sd = _MeanAndStdDevFromList([mean for (mean, _) in means_and_sds ]) - trace_name = _EscapePerfResult(trace) - output = '%s%s: %s%s%s %s' % ( - RESULT_TYPES[result_type], - _EscapePerfResult(measurement), - trace_name, - # Do not show equal sign if the trace is empty. Usually it happens when - # measurement is enough clear to describe the result. - '= ' if trace_name else '', - value, - units) if avg: output += '\nAvg %s: %f%s' % (measurement, avg, units) if sd: |