| 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 math | 10 import math |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 '= ' if trace_name else '', | 103 '= ' if trace_name else '', |
| 104 value, | 104 value, |
| 105 units) | 105 units) |
| 106 else: | 106 else: |
| 107 assert(result_type in ['histogram', 'unimportant-histogram']) | 107 assert(result_type in ['histogram', 'unimportant-histogram']) |
| 108 assert isinstance(values, list) | 108 assert isinstance(values, list) |
| 109 # The histograms can only be printed individually, there's no computation | 109 # The histograms can only be printed individually, there's no computation |
| 110 # across different histograms. | 110 # across different histograms. |
| 111 assert len(values) == 1 | 111 assert len(values) == 1 |
| 112 value = values[0] | 112 value = values[0] |
| 113 measurement += '.' + trace_name | |
| 114 output = '%s%s: %s= %s' % ( | 113 output = '%s%s: %s= %s' % ( |
| 115 RESULT_TYPES[result_type], | 114 RESULT_TYPES[result_type], |
| 116 _EscapePerfResult(measurement), | 115 _EscapePerfResult(measurement), |
| 117 _EscapePerfResult(measurement), | 116 trace_name, |
| 118 value) | 117 value) |
| 119 avg, sd = GeomMeanAndStdDevFromHistogram(value) | 118 avg, sd = GeomMeanAndStdDevFromHistogram(value) |
| 120 | 119 |
| 121 if avg: | 120 if avg: |
| 122 output += '\nAvg %s: %f%s' % (measurement, avg, units) | 121 output += '\nAvg %s: %f%s' % (measurement, avg, units) |
| 123 if sd: | 122 if sd: |
| 124 output += '\nSd %s: %f%s' % (measurement, sd, units) | 123 output += '\nSd %s: %f%s' % (measurement, sd, units) |
| 125 if print_to_stdout: | 124 if print_to_stdout: |
| 126 print output | 125 print output |
| 127 sys.stdout.flush() | 126 sys.stdout.flush() |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 """Tears down performance tests.""" | 159 """Tears down performance tests.""" |
| 161 if self._original_scaling_governor: | 160 if self._original_scaling_governor: |
| 162 self._SetScalingGovernorInternal(self._original_scaling_governor) | 161 self._SetScalingGovernorInternal(self._original_scaling_governor) |
| 163 self._original_scaling_governor = None | 162 self._original_scaling_governor = None |
| 164 | 163 |
| 165 def _SetScalingGovernorInternal(self, value): | 164 def _SetScalingGovernorInternal(self, value): |
| 166 for cpu in range(self._kernel_max + 1): | 165 for cpu in range(self._kernel_max + 1): |
| 167 scaling_governor_file = PerfTestSetup._SCALING_GOVERNOR_FMT % cpu | 166 scaling_governor_file = PerfTestSetup._SCALING_GOVERNOR_FMT % cpu |
| 168 if self._adb.FileExistsOnDevice(scaling_governor_file): | 167 if self._adb.FileExistsOnDevice(scaling_governor_file): |
| 169 self._adb.SetProtectedFileContents(scaling_governor_file, value) | 168 self._adb.SetProtectedFileContents(scaling_governor_file, value) |
| OLD | NEW |