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 """Performance Test Bisect Tool | 6 """Performance Test Bisect Tool |
7 | 7 |
8 This script bisects a series of changelists using binary search. It starts at | 8 This script bisects a series of changelists using binary search. It starts at |
9 a bad revision where a performance metric has regressed, and asks for a last | 9 a bad revision where a performance metric has regressed, and asks for a last |
10 known-good revision. It will then binary search across this revision range by | 10 known-good revision. It will then binary search across this revision range by |
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2230 next_revision_data['passed'] = 'Build Failed' | 2230 next_revision_data['passed'] = 'Build Failed' |
2231 | 2231 |
2232 print run_results[0] | 2232 print run_results[0] |
2233 | 2233 |
2234 # If the build is broken, remove it and redo search. | 2234 # If the build is broken, remove it and redo search. |
2235 revision_list.pop(next_revision_index) | 2235 revision_list.pop(next_revision_index) |
2236 | 2236 |
2237 max_revision -= 1 | 2237 max_revision -= 1 |
2238 | 2238 |
2239 if self.opts.output_buildbot_annotations: | 2239 if self.opts.output_buildbot_annotations: |
2240 self._PrintPartialResults(results) | |
2240 bisect_utils.OutputAnnotationStepClosed() | 2241 bisect_utils.OutputAnnotationStepClosed() |
2241 else: | 2242 else: |
2242 # Weren't able to sync and retrieve the revision range. | 2243 # Weren't able to sync and retrieve the revision range. |
2243 results['error'] = 'An error occurred attempting to retrieve revision '\ | 2244 results['error'] = 'An error occurred attempting to retrieve revision '\ |
2244 'range: [%s..%s]' % (good_revision, bad_revision) | 2245 'range: [%s..%s]' % (good_revision, bad_revision) |
2245 | 2246 |
2246 return results | 2247 return results |
2247 | 2248 |
2249 def _PrintPartialResults(self, results_dict): | |
2250 revision_data = results_dict['revision_data'] | |
2251 revision_data_sorted = sorted(revision_data.iteritems(), | |
2252 key = lambda x: x[1]['sort']) | |
2253 results_dict = self._GetResultsDict(revision_data, revision_data_sorted) | |
2254 first_working_revision = results_dict['first_working_revision'] | |
2255 last_broken_revision = results_dict['last_broken_revision'] | |
2256 | |
2257 print | |
2258 print 'Partial results:' | |
2259 print ' %20s %40s %12s %14s %13s' % ('Depot'.center(20, ' '), | |
2260 'Commit SHA'.center(40, ' '), 'Mean'.center(12, ' '), | |
2261 'Std. Error'.center(14, ' '), 'State'.center(13, ' ')) | |
2262 state = 0 | |
2263 for current_id, current_data in revision_data_sorted: | |
tonyg
2014/01/06 22:44:57
Seems like there could be some code reuse here, bu
shatch
2014/01/06 23:35:48
Folded it all into _PrintTestedCommitsTable.
| |
2264 if current_data['value']: | |
2265 if (current_id == last_broken_revision or | |
2266 current_id == first_working_revision): | |
2267 state += 1 | |
2268 if state == 2: | |
2269 print | |
2270 | |
2271 state_str = 'Bad' | |
2272 if state == 2: | |
2273 state_str = 'Good' | |
2274 state_str = state_str.center(13, ' ') | |
2275 | |
2276 std_error = ('+-%.02f' % | |
2277 current_data['value']['std_err']).center(14, ' ') | |
2278 mean = ('%.02f' % current_data['value']['mean']).center(12, ' ') | |
2279 print ' %20s %40s %12s %14s %13s' % ( | |
2280 current_data['depot'].center(20, ' '), current_id, mean, | |
2281 std_error, state_str) | |
2282 | |
2248 def _PrintConfidence(self, results_dict): | 2283 def _PrintConfidence(self, results_dict): |
2249 # The perf dashboard specifically looks for the string | 2284 # The perf dashboard specifically looks for the string |
2250 # "Confidence in Bisection Results: 100%" to decide whether or not | 2285 # "Confidence in Bisection Results: 100%" to decide whether or not |
2251 # to cc the author(s). If you change this, please update the perf | 2286 # to cc the author(s). If you change this, please update the perf |
2252 # dashboard as well. | 2287 # dashboard as well. |
2253 print 'Confidence in Bisection Results: %d%%' % results_dict['confidence'] | 2288 print 'Confidence in Bisection Results: %d%%' % results_dict['confidence'] |
2254 | 2289 |
2255 def _PrintBanner(self, results_dict): | 2290 def _PrintBanner(self, results_dict): |
2256 print | 2291 print |
2257 print " __o_\___ Aw Snap! We hit a speed bump!" | 2292 print " __o_\___ Aw Snap! We hit a speed bump!" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2373 print | 2408 print |
2374 print 'Average build time : %s' % datetime.timedelta( | 2409 print 'Average build time : %s' % datetime.timedelta( |
2375 seconds=int(step_build_time_avg)) | 2410 seconds=int(step_build_time_avg)) |
2376 print 'Average test time : %s' % datetime.timedelta( | 2411 print 'Average test time : %s' % datetime.timedelta( |
2377 seconds=int(step_perf_time_avg)) | 2412 seconds=int(step_perf_time_avg)) |
2378 | 2413 |
2379 def _PrintWarnings(self): | 2414 def _PrintWarnings(self): |
2380 if not self.warnings: | 2415 if not self.warnings: |
2381 return | 2416 return |
2382 print | 2417 print |
2418 self.warnings = set(self.warnings) | |
2383 print 'WARNINGS:' | 2419 print 'WARNINGS:' |
2384 for w in self.warnings: | 2420 for w in self.warnings: |
tonyg
2014/01/06 22:44:57
Nit: Just inline the set() here.
shatch
2014/01/06 23:35:48
Done.
| |
2385 print ' !!! %s' % w | 2421 print ' !!! %s' % w |
2386 | 2422 |
2387 def _GetResultsDict(self, revision_data, revision_data_sorted): | 2423 def _GetResultsDict(self, revision_data, revision_data_sorted): |
2388 # Find range where it possibly broke. | 2424 # Find range where it possibly broke. |
2389 first_working_revision = None | 2425 first_working_revision = None |
2390 first_working_revision_index = -1 | 2426 first_working_revision_index = -1 |
2391 last_broken_revision = None | 2427 last_broken_revision = None |
2392 last_broken_revision_index = -1 | 2428 last_broken_revision_index = -1 |
2393 | 2429 |
2394 for i in xrange(len(revision_data_sorted)): | 2430 for i in xrange(len(revision_data_sorted)): |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2966 # The perf dashboard scrapes the "results" step in order to comment on | 3002 # The perf dashboard scrapes the "results" step in order to comment on |
2967 # bugs. If you change this, please update the perf dashboard as well. | 3003 # bugs. If you change this, please update the perf dashboard as well. |
2968 bisect_utils.OutputAnnotationStepStart('Results') | 3004 bisect_utils.OutputAnnotationStepStart('Results') |
2969 print 'Error: %s' % e.message | 3005 print 'Error: %s' % e.message |
2970 if opts.output_buildbot_annotations: | 3006 if opts.output_buildbot_annotations: |
2971 bisect_utils.OutputAnnotationStepClosed() | 3007 bisect_utils.OutputAnnotationStepClosed() |
2972 return 1 | 3008 return 1 |
2973 | 3009 |
2974 if __name__ == '__main__': | 3010 if __name__ == '__main__': |
2975 sys.exit(main()) | 3011 sys.exit(main()) |
OLD | NEW |