| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2014 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 """ Generate bench_expectations file from a given set of bench data files. """ | 6 """ Generate bench_expectations file from a given set of bench data files. """ |
| 7 | 7 |
| 8 import argparse | 8 import argparse |
| 9 import bench_util | 9 import bench_util |
| 10 import os | 10 import os |
| 11 import re | 11 import re |
| 12 import sys | 12 import sys |
| 13 | 13 |
| 14 # Parameters for calculating bench ranges. | 14 # Parameters for calculating bench ranges. |
| 15 RANGE_RATIO_UPPER = 1.2 # Ratio of range for upper bounds. | 15 RANGE_RATIO_UPPER = 1.2 # Ratio of range for upper bounds. |
| 16 RANGE_RATIO_LOWER = 1.8 # Ratio of range for lower bounds. | 16 RANGE_RATIO_LOWER = 1.8 # Ratio of range for lower bounds. |
| 17 ERR_RATIO = 0.08 # Further widens the range by the ratio of average value. | 17 ERR_RATIO = 0.08 # Further widens the range by the ratio of average value. |
| 18 ERR_ABS = 0.5 # Adds an absolute error margin to cope with very small benches. | 18 ERR_ABS = 0.5 # Adds an absolute error margin to cope with very small benches. |
| 19 | 19 |
| 20 # List of bench configs to monitor. Ignore all other configs. | 20 # List of bench configs to monitor. Ignore all other configs. |
| 21 CONFIGS_TO_INCLUDE = ['simple_viewport_1000x1000', | 21 CONFIGS_TO_INCLUDE = ['simple_viewport_1000x1000', |
| 22 'simple_viewport_1000x1000_gpu', | 22 'simple_viewport_1000x1000_gpu', |
| 23 'simple_viewport_1000x1000_scalar_1.100000', | 23 'simple_viewport_1000x1000_scalar_1.100000', |
| 24 'simple_viewport_1000x1000_scalar_1.100000_gpu', | 24 'simple_viewport_1000x1000_scalar_1.100000_gpu', |
| 25 ] | 25 ] |
| 26 | 26 |
| 27 # List of flaky SKPs that should be excluded. |
| 28 SKPS_TO_EXCLUDE = ['desk_chalkboard.skp', |
| 29 ] |
| 30 |
| 27 | 31 |
| 28 def compute_ranges(benches): | 32 def compute_ranges(benches): |
| 29 """Given a list of bench numbers, calculate the alert range. | 33 """Given a list of bench numbers, calculate the alert range. |
| 30 | 34 |
| 31 Args: | 35 Args: |
| 32 benches: a list of float bench values. | 36 benches: a list of float bench values. |
| 33 | 37 |
| 34 Returns: | 38 Returns: |
| 35 a list of float [lower_bound, upper_bound]. | 39 a list of float [lower_bound, upper_bound]. |
| 36 """ | 40 """ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 revision_data_points: a list of BenchDataPoint objects. | 54 revision_data_points: a list of BenchDataPoint objects. |
| 51 | 55 |
| 52 Returns: | 56 Returns: |
| 53 a dictionary of this form: | 57 a dictionary of this form: |
| 54 keys = tuple of (config, bench) strings. | 58 keys = tuple of (config, bench) strings. |
| 55 values = list of float [expected, lower_bound, upper_bound] for the key. | 59 values = list of float [expected, lower_bound, upper_bound] for the key. |
| 56 """ | 60 """ |
| 57 bench_dict = {} | 61 bench_dict = {} |
| 58 for point in revision_data_points: | 62 for point in revision_data_points: |
| 59 if (point.time_type or # Not walltime which has time_type '' | 63 if (point.time_type or # Not walltime which has time_type '' |
| 60 not point.config in CONFIGS_TO_INCLUDE): | 64 not point.config in CONFIGS_TO_INCLUDE or |
| 65 point.bench in SKPS_TO_EXCLUDE): |
| 61 continue | 66 continue |
| 62 key = (point.config, point.bench) | 67 key = (point.config, point.bench) |
| 63 if key in bench_dict: | 68 if key in bench_dict: |
| 64 raise Exception('Duplicate bench entry: ' + str(key)) | 69 raise Exception('Duplicate bench entry: ' + str(key)) |
| 65 bench_dict[key] = [point.time] + compute_ranges(point.per_iter_time) | 70 bench_dict[key] = [point.time] + compute_ranges(point.per_iter_time) |
| 66 | 71 |
| 67 return bench_dict | 72 return bench_dict |
| 68 | 73 |
| 69 | 74 |
| 70 def main(): | 75 def main(): |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 'expected': expected, | 114 'expected': expected, |
| 110 'lower_bound': lower_bound, | 115 'lower_bound': lower_bound, |
| 111 'upper_bound': upper_bound}) | 116 'upper_bound': upper_bound}) |
| 112 | 117 |
| 113 with open(args.output_file, 'w') as file_handle: | 118 with open(args.output_file, 'w') as file_handle: |
| 114 file_handle.write('\n'.join(out_lines)) | 119 file_handle.write('\n'.join(out_lines)) |
| 115 | 120 |
| 116 | 121 |
| 117 if __name__ == "__main__": | 122 if __name__ == "__main__": |
| 118 main() | 123 main() |
| OLD | NEW |