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

Side by Side Diff: bench/gen_bench_expectations.py

Issue 266023005: Fixes lower/upper typo. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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
« 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 #!/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
(...skipping 26 matching lines...) Expand all
37 benches: a list of float bench values. 37 benches: a list of float bench values.
38 38
39 Returns: 39 Returns:
40 a list of float [lower_bound, upper_bound]. 40 a list of float [lower_bound, upper_bound].
41 """ 41 """
42 minimum = min(benches) 42 minimum = min(benches)
43 maximum = max(benches) 43 maximum = max(benches)
44 diff = maximum - minimum 44 diff = maximum - minimum
45 avg = sum(benches) / len(benches) 45 avg = sum(benches) / len(benches)
46 46
47 return [minimum - diff * RANGE_RATIO_LOWER - avg * ERR_RATIO - ERR_UB, 47 return [minimum - diff * RANGE_RATIO_LOWER - avg * ERR_RATIO - ERR_LB,
48 maximum + diff * RANGE_RATIO_UPPER + avg * ERR_RATIO + ERR_LB] 48 maximum + diff * RANGE_RATIO_UPPER + avg * ERR_RATIO + ERR_UB]
49 49
50 50
51 def create_expectations_dict(revision_data_points): 51 def create_expectations_dict(revision_data_points):
52 """Convert list of bench data points into a dictionary of expectations data. 52 """Convert list of bench data points into a dictionary of expectations data.
53 53
54 Args: 54 Args:
55 revision_data_points: a list of BenchDataPoint objects. 55 revision_data_points: a list of BenchDataPoint objects.
56 56
57 Returns: 57 Returns:
58 a dictionary of this form: 58 a dictionary of this form:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 'expected': expected, 115 'expected': expected,
116 'lower_bound': lower_bound, 116 'lower_bound': lower_bound,
117 'upper_bound': upper_bound}) 117 'upper_bound': upper_bound})
118 118
119 with open(args.output_file, 'w') as file_handle: 119 with open(args.output_file, 'w') as file_handle:
120 file_handle.write('\n'.join(out_lines)) 120 file_handle.write('\n'.join(out_lines))
121 121
122 122
123 if __name__ == "__main__": 123 if __name__ == "__main__":
124 main() 124 main()
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