| 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 | 6 |
| 7 import android_commands | 7 import android_commands |
| 8 import json | 8 import json |
| 9 import math | 9 import math |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 # The histograms can only be printed individually, there's no computation | 106 # The histograms can only be printed individually, there's no computation |
| 107 # across different histograms. | 107 # across different histograms. |
| 108 assert len(values) == 1 | 108 assert len(values) == 1 |
| 109 value = values[0] | 109 value = values[0] |
| 110 measurement += '.' + trace_name | 110 measurement += '.' + trace_name |
| 111 output = '%s%s: %s=%s' % ( | 111 output = '%s%s: %s= %s' % ( |
| 112 RESULT_TYPES[result_type], | 112 RESULT_TYPES[result_type], |
| 113 _EscapePerfResult(measurement), | 113 _EscapePerfResult(measurement), |
| 114 _EscapePerfResult(measurement), | 114 _EscapePerfResult(measurement), |
| 115 value) | 115 value) |
| 116 avg, sd = GeomMeanAndStdDevFromHistogram(value) | 116 avg, sd = GeomMeanAndStdDevFromHistogram(value) |
| 117 | 117 |
| 118 if avg: | 118 if avg: |
| 119 output += '\nAvg %s: %f%s' % (measurement, avg, units) | 119 output += '\nAvg %s: %f%s' % (measurement, avg, units) |
| 120 if sd: | 120 if sd: |
| 121 output += '\nSd %s: %f%s' % (measurement, sd, units) | 121 output += '\nSd %s: %f%s' % (measurement, sd, units) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 def TearDown(self): | 156 def TearDown(self): |
| 157 """Tears down performance tests.""" | 157 """Tears down performance tests.""" |
| 158 if self._original_scaling_governor: | 158 if self._original_scaling_governor: |
| 159 self._SetScalingGovernorInternal(self._original_scaling_governor) | 159 self._SetScalingGovernorInternal(self._original_scaling_governor) |
| 160 self._original_scaling_governor = None | 160 self._original_scaling_governor = None |
| 161 | 161 |
| 162 def _SetScalingGovernorInternal(self, value): | 162 def _SetScalingGovernorInternal(self, value): |
| 163 for cpu in range(self._num_cpus): | 163 for cpu in range(self._num_cpus): |
| 164 self._adb.RunShellCommand( | 164 self._adb.RunShellCommand( |
| 165 ('echo %s > ' + PerfTestSetup._SCALING_GOVERNOR) % (value, cpu)) | 165 ('echo %s > ' + PerfTestSetup._SCALING_GOVERNOR) % (value, cpu)) |
| OLD | NEW |