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

Side by Side Diff: build/android/pylib/perf_tests_helper.py

Issue 11573008: Telemetry: More elegant histogram printing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review (bulach) Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/telemetry/telemetry/multi_page_benchmark.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import re 5 import re
6 6
7 import android_commands 7 import android_commands
8 import json 8 import json
9 import math 9 import math
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 _EscapePerfResult(measurement), 96 _EscapePerfResult(measurement),
97 trace_name, 97 trace_name,
98 # Do not show equal sign if the trace is empty. Usually it happens when 98 # Do not show equal sign if the trace is empty. Usually it happens when
99 # measurement is enough clear to describe the result. 99 # measurement is enough clear to describe the result.
100 '= ' if trace_name else '', 100 '= ' if trace_name else '',
101 value, 101 value,
102 units) 102 units)
103 else: 103 else:
104 assert(result_type in ['histogram', 'unimportant-histogram']) 104 assert(result_type in ['histogram', 'unimportant-histogram'])
105 assert isinstance(values, list) 105 assert isinstance(values, list)
106 assert len(values) 106 # The histograms can only be printed individually, there's no computation
107 # Print out each histogram separately. We can't print the units, otherwise 107 # across different histograms.
108 # the histogram json output can't be parsed easily. 108 assert len(values) == 1
109 output = '' 109 value = values[0]
110 ix = 1 110 measurement += '.' + trace_name
111 for value in values: 111 output = '%s%s: %s=%s' % (
112 name = '%s.%s_%d' % (_EscapePerfResult(measurement), trace_name, ix) 112 RESULT_TYPES[result_type],
113 output += '%s%s%s : %s = %s' % ( 113 _EscapePerfResult(measurement),
114 '\n' if ix > 1 else '', 114 _EscapePerfResult(measurement),
115 RESULT_TYPES[result_type], 115 value)
116 name, 116 avg, sd = GeomMeanAndStdDevFromHistogram(value)
117 name,
118 value)
119 ix += 1
120 measurement = '%s.%s' % (measurement, trace_name)
121 means_and_sds = [GeomMeanAndStdDevFromHistogram(value) for value in values]
122 _, avg, sd = _MeanAndStdDevFromList([mean for (mean, _) in means_and_sds ])
123 117
124 if avg: 118 if avg:
125 output += '\nAvg %s: %f%s' % (measurement, avg, units) 119 output += '\nAvg %s: %f%s' % (measurement, avg, units)
126 if sd: 120 if sd:
127 output += '\nSd %s: %f%s' % (measurement, sd, units) 121 output += '\nSd %s: %f%s' % (measurement, sd, units)
128 if print_to_stdout: 122 if print_to_stdout:
129 print output 123 print output
130 return output 124 return output
131 125
132 126
(...skipping 29 matching lines...) Expand all
162 def TearDown(self): 156 def TearDown(self):
163 """Tears down performance tests.""" 157 """Tears down performance tests."""
164 if self._original_scaling_governor: 158 if self._original_scaling_governor:
165 self._SetScalingGovernorInternal(self._original_scaling_governor) 159 self._SetScalingGovernorInternal(self._original_scaling_governor)
166 self._original_scaling_governor = None 160 self._original_scaling_governor = None
167 161
168 def _SetScalingGovernorInternal(self, value): 162 def _SetScalingGovernorInternal(self, value):
169 for cpu in range(self._num_cpus): 163 for cpu in range(self._num_cpus):
170 self._adb.RunShellCommand( 164 self._adb.RunShellCommand(
171 ('echo %s > ' + PerfTestSetup._SCALING_GOVERNOR) % (value, cpu)) 165 ('echo %s > ' + PerfTestSetup._SCALING_GOVERNOR) % (value, cpu))
OLDNEW
« no previous file with comments | « no previous file | tools/telemetry/telemetry/multi_page_benchmark.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698