OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Run Performance Test Bisect Tool | 6 """Run Performance Test Bisect Tool |
7 | 7 |
8 This script is used by a try bot to run the bisect script with the parameters | 8 This script is used by a try bot to run the bisect script with the parameters |
9 specified in the bisect config file. It checks out a copy of the depot in | 9 specified in the bisect config file. It checks out a copy of the depot in |
10 a subdirectory 'bisect' of the working directory provided, annd runs the | 10 a subdirectory 'bisect' of the working directory provided, annd runs the |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 opts_dict['command'] = config['command'] | 192 opts_dict['command'] = config['command'] |
193 opts_dict['metric'] = config.get('metric') | 193 opts_dict['metric'] = config.get('metric') |
194 | 194 |
195 if config['repeat_count']: | 195 if config['repeat_count']: |
196 opts_dict['repeat_test_count'] = int(config['repeat_count']) | 196 opts_dict['repeat_test_count'] = int(config['repeat_count']) |
197 | 197 |
198 if config['truncate_percent']: | 198 if config['truncate_percent']: |
199 opts_dict['truncate_percent'] = int(config['truncate_percent']) | 199 opts_dict['truncate_percent'] = int(config['truncate_percent']) |
200 | 200 |
201 if config['max_time_minutes']: | 201 if config['max_time_minutes']: |
202 opts_dict['max_time_minutes'] = int(config['max_time_minutes']) | 202 opts_dict['max_time_minutes'] = _Clamp( |
| 203 int(config['max_time_minutes']), low=1, high=60) |
203 | 204 |
204 if config.has_key('use_goma'): | 205 if config.has_key('use_goma'): |
205 opts_dict['use_goma'] = config['use_goma'] | 206 opts_dict['use_goma'] = config['use_goma'] |
206 if config.has_key('goma_dir'): | 207 if config.has_key('goma_dir'): |
207 opts_dict['goma_dir'] = config['goma_dir'] | 208 opts_dict['goma_dir'] = config['goma_dir'] |
208 | 209 |
209 if config.has_key('improvement_direction'): | 210 if config.has_key('improvement_direction'): |
210 opts_dict['improvement_direction'] = int(config['improvement_direction']) | 211 opts_dict['improvement_direction'] = int(config['improvement_direction']) |
211 | 212 |
212 if config.has_key('target_arch'): | 213 if config.has_key('target_arch'): |
(...skipping 18 matching lines...) Expand all Loading... |
231 if 'android-chromium' in config['command']: | 232 if 'android-chromium' in config['command']: |
232 opts_dict['target_platform'] = 'android' | 233 opts_dict['target_platform'] = 'android' |
233 elif 'android-chrome' in config['command']: | 234 elif 'android-chrome' in config['command']: |
234 opts_dict['target_platform'] = 'android-chrome' | 235 opts_dict['target_platform'] = 'android-chrome' |
235 else: | 236 else: |
236 opts_dict['target_platform'] = 'android' | 237 opts_dict['target_platform'] = 'android' |
237 | 238 |
238 return bisect_perf_regression.BisectOptions.FromDict(opts_dict) | 239 return bisect_perf_regression.BisectOptions.FromDict(opts_dict) |
239 | 240 |
240 | 241 |
| 242 def _Clamp(n, low, high): |
| 243 """Clamps a value to a range.""" |
| 244 return min(high, max(low, n)) |
| 245 |
| 246 |
241 def _ParseCloudLinksFromOutput(output): | 247 def _ParseCloudLinksFromOutput(output): |
242 html_results_pattern = re.compile( | 248 html_results_pattern = re.compile( |
243 r'\s(?P<VALUES>http://storage.googleapis.com/' + | 249 r'\s(?P<VALUES>http://storage.googleapis.com/' + |
244 'chromium-telemetry/html-results/results-[a-z0-9-_]+)\s', | 250 'chromium-telemetry/html-results/results-[a-z0-9-_]+)\s', |
245 re.MULTILINE) | 251 re.MULTILINE) |
246 profiler_pattern = re.compile( | 252 profiler_pattern = re.compile( |
247 r'\s(?P<VALUES>https://console.developers.google.com/' + | 253 r'\s(?P<VALUES>https://console.developers.google.com/' + |
248 'm/cloudstorage/b/[a-z-]+/o/profiler-[a-z0-9-_.]+)\s', | 254 'm/cloudstorage/b/[a-z-]+/o/profiler-[a-z0-9-_.]+)\s', |
249 re.MULTILINE) | 255 re.MULTILINE) |
250 | 256 |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 return _SetupAndRunPerformanceTest( | 868 return _SetupAndRunPerformanceTest( |
863 config={}, path_to_goma=opts.path_to_goma, is_cq_tryjob=True) | 869 config={}, path_to_goma=opts.path_to_goma, is_cq_tryjob=True) |
864 | 870 |
865 print ('Error: Could not load config file. Double check your changes to ' | 871 print ('Error: Could not load config file. Double check your changes to ' |
866 'auto_bisect/bisect.cfg or run-perf-test.cfg for syntax errors.\n') | 872 'auto_bisect/bisect.cfg or run-perf-test.cfg for syntax errors.\n') |
867 return 1 | 873 return 1 |
868 | 874 |
869 | 875 |
870 if __name__ == '__main__': | 876 if __name__ == '__main__': |
871 sys.exit(main()) | 877 sys.exit(main()) |
OLD | NEW |