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

Side by Side Diff: bench/gen_bench_expectations.py

Issue 334673002: Revert trigger changes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 28 matching lines...) Expand all
39 39
40 def compute_ranges(benches): 40 def compute_ranges(benches):
41 """Given a list of bench numbers, calculate the alert range. 41 """Given a list of bench numbers, calculate the alert range.
42 42
43 Args: 43 Args:
44 benches: a list of float bench values. 44 benches: a list of float bench values.
45 45
46 Returns: 46 Returns:
47 a list of float [lower_bound, upper_bound]. 47 a list of float [lower_bound, upper_bound].
48 """ 48 """
49 avg = sum(benches) / len(benches) 49 avg = sum(benches)/len(benches)
50 squared_avg = avg ** 2 50 minimum = min(benches)
51 avg_sum_squared = sum([bench**2 for bench in benches])/len(benches) 51 maximum = max(benches)
52 std_dev = (abs(avg_sum_squared - squared_avg) + 0.0001*abs(avg**2)) ** 0.5
53 52
54 # If the results are normally distributed, 2 standard deviations 53 return [minimum - diff*RANGE_RATIO_LOWER - avg*ERR_RATIO - ERR_LB,
55 # captures something like ~95% of the possible range of results I think 54 maximum + diff*RANGE_RATIO_UPPER + avg*ERR_RATIO + ERR_UB]
56 return [avg - 2*std_dev, avg + 2*std_dev]
57 55
58 56
59 def create_expectations_dict(revision_data_points, builder): 57 def create_expectations_dict(revision_data_points, builder):
60 """Convert list of bench data points into a dictionary of expectations data. 58 """Convert list of bench data points into a dictionary of expectations data.
61 59
62 Args: 60 Args:
63 revision_data_points: a list of BenchDataPoint objects. 61 revision_data_points: a list of BenchDataPoint objects.
64 builder: string of the corresponding buildbot builder name. 62 builder: string of the corresponding buildbot builder name.
65 63
66 Returns: 64 Returns:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 'expected': expected, 129 'expected': expected,
132 'lower_bound': lower_bound, 130 'lower_bound': lower_bound,
133 'upper_bound': upper_bound}) 131 'upper_bound': upper_bound})
134 132
135 with open(args.output_file, 'w') as file_handle: 133 with open(args.output_file, 'w') as file_handle:
136 file_handle.write('\n'.join(out_lines)) 134 file_handle.write('\n'.join(out_lines))
137 135
138 136
139 if __name__ == "__main__": 137 if __name__ == "__main__":
140 main() 138 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