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

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

Issue 11779042: Test data output fix for Telemetry & Android: remove more special chars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 6
7 import android_commands 7 import android_commands
8 import json 8 import json
9 import math 9 import math
10 10
11 # Valid values of result type. 11 # Valid values of result type.
12 RESULT_TYPES = {'unimportant': 'RESULT ', 12 RESULT_TYPES = {'unimportant': 'RESULT ',
13 'default': '*RESULT ', 13 'default': '*RESULT ',
14 'informational': '', 14 'informational': '',
15 'unimportant-histogram': 'HISTOGRAM ', 15 'unimportant-histogram': 'HISTOGRAM ',
16 'histogram': '*HISTOGRAM '} 16 'histogram': '*HISTOGRAM '}
17 17
18 18
19 def _EscapePerfResult(s): 19 def _EscapePerfResult(s):
20 """Escapes |s| for use in a perf result.""" 20 """Escapes |s| for use in a perf result."""
21 # Colons (:), equal signs (=) and slashes (/) are not allowed. 21 return re.sub('[\:|=/#&]', '_', s)
22 return re.sub('[\:|=/]', '_', s)
23 22
24 23
25 def GeomMeanAndStdDevFromHistogram(histogram_json): 24 def GeomMeanAndStdDevFromHistogram(histogram_json):
26 histogram = json.loads(histogram_json) 25 histogram = json.loads(histogram_json)
27 count = 0 26 count = 0
28 sum_of_logs = 0 27 sum_of_logs = 0
29 for bucket in histogram['buckets']: 28 for bucket in histogram['buckets']:
30 if 'high' in bucket: 29 if 'high' in bucket:
31 bucket['mean'] = (bucket['low'] + bucket['high']) / 2.0 30 bucket['mean'] = (bucket['low'] + bucket['high']) / 2.0
32 else: 31 else:
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 def TearDown(self): 155 def TearDown(self):
157 """Tears down performance tests.""" 156 """Tears down performance tests."""
158 if self._original_scaling_governor: 157 if self._original_scaling_governor:
159 self._SetScalingGovernorInternal(self._original_scaling_governor) 158 self._SetScalingGovernorInternal(self._original_scaling_governor)
160 self._original_scaling_governor = None 159 self._original_scaling_governor = None
161 160
162 def _SetScalingGovernorInternal(self, value): 161 def _SetScalingGovernorInternal(self, value):
163 for cpu in range(self._num_cpus): 162 for cpu in range(self._num_cpus):
164 self._adb.RunShellCommand( 163 self._adb.RunShellCommand(
165 ('echo %s > ' + PerfTestSetup._SCALING_GOVERNOR) % (value, cpu)) 164 ('echo %s > ' + PerfTestSetup._SCALING_GOVERNOR) % (value, cpu))
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