OLD | NEW |
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 import sys | 6 import sys |
7 | 7 |
8 import android_commands | 8 import android_commands |
9 import json | 9 import json |
10 import logging | 10 import logging |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 '= ' if trace_name else '', | 121 '= ' if trace_name else '', |
122 value, | 122 value, |
123 units) | 123 units) |
124 else: | 124 else: |
125 assert(result_type in ['histogram', 'unimportant-histogram']) | 125 assert(result_type in ['histogram', 'unimportant-histogram']) |
126 assert isinstance(values, list) | 126 assert isinstance(values, list) |
127 # The histograms can only be printed individually, there's no computation | 127 # The histograms can only be printed individually, there's no computation |
128 # across different histograms. | 128 # across different histograms. |
129 assert len(values) == 1 | 129 assert len(values) == 1 |
130 value = values[0] | 130 value = values[0] |
131 output = '%s%s: %s= %s' % ( | 131 output = '%s%s: %s= %s %s' % ( |
132 RESULT_TYPES[result_type], | 132 RESULT_TYPES[result_type], |
133 _EscapePerfResult(measurement), | 133 _EscapePerfResult(measurement), |
134 trace_name, | 134 trace_name, |
135 value) | 135 value, |
| 136 units) |
136 avg, sd = GeomMeanAndStdDevFromHistogram(value) | 137 avg, sd = GeomMeanAndStdDevFromHistogram(value) |
137 | 138 |
138 if avg: | 139 if avg: |
139 output += '\nAvg %s: %f%s' % (measurement, avg, units) | 140 output += '\nAvg %s: %f%s' % (measurement, avg, units) |
140 if sd: | 141 if sd: |
141 output += '\nSd %s: %f%s' % (measurement, sd, units) | 142 output += '\nSd %s: %f%s' % (measurement, sd, units) |
142 if print_to_stdout: | 143 if print_to_stdout: |
143 print output | 144 print output |
144 sys.stdout.flush() | 145 sys.stdout.flush() |
145 return output | 146 return output |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 """Resets the original performance mode of the device.""" | 194 """Resets the original performance mode of the device.""" |
194 self._SetScalingGovernorInternal(self._original_scaling_governor) | 195 self._SetScalingGovernorInternal(self._original_scaling_governor) |
195 | 196 |
196 def _SetScalingGovernorInternal(self, value): | 197 def _SetScalingGovernorInternal(self, value): |
197 for cpu in range(self._kernel_max + 1): | 198 for cpu in range(self._kernel_max + 1): |
198 scaling_governor_file = PerfControl._SCALING_GOVERNOR_FMT % cpu | 199 scaling_governor_file = PerfControl._SCALING_GOVERNOR_FMT % cpu |
199 if self._adb.FileExistsOnDevice(scaling_governor_file): | 200 if self._adb.FileExistsOnDevice(scaling_governor_file): |
200 logging.info('Writing scaling governor mode \'%s\' -> %s' % | 201 logging.info('Writing scaling governor mode \'%s\' -> %s' % |
201 (value, scaling_governor_file)) | 202 (value, scaling_governor_file)) |
202 self._adb.SetProtectedFileContents(scaling_governor_file, value) | 203 self._adb.SetProtectedFileContents(scaling_governor_file, value) |
OLD | NEW |