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

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

Issue 11886071: Telemetry & Android: fix stderr / stdout getting mixed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review (bulach) Created 7 years, 11 months 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 | no next file » | 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 import sys
6 7
7 import android_commands 8 import android_commands
8 import json 9 import json
9 import math 10 import math
10 11
11 # Valid values of result type. 12 # Valid values of result type.
12 RESULT_TYPES = {'unimportant': 'RESULT ', 13 RESULT_TYPES = {'unimportant': 'RESULT ',
13 'default': '*RESULT ', 14 'default': '*RESULT ',
14 'informational': '', 15 'informational': '',
15 'unimportant-histogram': 'HISTOGRAM ', 16 'unimportant-histogram': 'HISTOGRAM ',
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 _EscapePerfResult(measurement), 117 _EscapePerfResult(measurement),
117 value) 118 value)
118 avg, sd = GeomMeanAndStdDevFromHistogram(value) 119 avg, sd = GeomMeanAndStdDevFromHistogram(value)
119 120
120 if avg: 121 if avg:
121 output += '\nAvg %s: %f%s' % (measurement, avg, units) 122 output += '\nAvg %s: %f%s' % (measurement, avg, units)
122 if sd: 123 if sd:
123 output += '\nSd %s: %f%s' % (measurement, sd, units) 124 output += '\nSd %s: %f%s' % (measurement, sd, units)
124 if print_to_stdout: 125 if print_to_stdout:
125 print output 126 print output
127 sys.stdout.flush()
126 return output 128 return output
127 129
128 130
129 class PerfTestSetup(object): 131 class PerfTestSetup(object):
130 """Provides methods for setting up a device for perf testing.""" 132 """Provides methods for setting up a device for perf testing."""
131 _DROP_CACHES = '/proc/sys/vm/drop_caches' 133 _DROP_CACHES = '/proc/sys/vm/drop_caches'
132 _SCALING_GOVERNOR_FMT = ( 134 _SCALING_GOVERNOR_FMT = (
133 '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor') 135 '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor')
134 136
135 def __init__(self, adb): 137 def __init__(self, adb):
(...skipping 25 matching lines...) Expand all
161 if self._original_scaling_governor: 163 if self._original_scaling_governor:
162 self._SetScalingGovernorInternal(self._original_scaling_governor) 164 self._SetScalingGovernorInternal(self._original_scaling_governor)
163 self._original_scaling_governor = None 165 self._original_scaling_governor = None
164 166
165 def _SetScalingGovernorInternal(self, value): 167 def _SetScalingGovernorInternal(self, value):
166 for cpu in range(self._kernel_max + 1): 168 for cpu in range(self._kernel_max + 1):
167 scaling_governor_file = PerfTestSetup._SCALING_GOVERNOR_FMT % cpu 169 scaling_governor_file = PerfTestSetup._SCALING_GOVERNOR_FMT % cpu
168 if self._adb.Adb().DoesFileExist(scaling_governor_file): 170 if self._adb.Adb().DoesFileExist(scaling_governor_file):
169 self._adb.RunShellCommand( 171 self._adb.RunShellCommand(
170 ('echo %s > ' + scaling_governor_file) % value) 172 ('echo %s > ' + scaling_governor_file) % value)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698