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 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2521 confidence_status = 'Successful with %(level)s confidence%(warning)s.' | 2521 confidence_status = 'Successful with %(level)s confidence%(warning)s.' |
2522 if results_dict['confidence'] >= HIGH_CONFIDENCE: | 2522 if results_dict['confidence'] >= HIGH_CONFIDENCE: |
2523 level = 'high' | 2523 level = 'high' |
2524 else: | 2524 else: |
2525 level = 'low' | 2525 level = 'low' |
2526 warning = ' and warnings' | 2526 warning = ' and warnings' |
2527 if not self.warnings: | 2527 if not self.warnings: |
2528 warning = '' | 2528 warning = '' |
2529 return confidence_status % {'level': level, 'warning': warning} | 2529 return confidence_status % {'level': level, 'warning': warning} |
2530 | 2530 |
2531 def _GetViewVCLinkFromDepotAndHash(self, cl, depot): | 2531 def _GetViewVCLinkFromDepotAndHash(self, revision_id, depot): |
2532 info = self.source_control.QueryRevisionInfo(cl, | 2532 """Gets link to the repository browser.""" |
| 2533 info = self.source_control.QueryRevisionInfo(revision_id, |
2533 self.depot_registry.GetDepotDir(depot)) | 2534 self.depot_registry.GetDepotDir(depot)) |
2534 if depot and DEPOT_DEPS_NAME[depot].has_key('viewvc'): | 2535 if depot and DEPOT_DEPS_NAME[depot].has_key('viewvc'): |
2535 try: | 2536 try: |
2536 # Format is "git-svn-id: svn://....@123456 <other data>" | 2537 # Format is "git-svn-id: svn://....@123456 <other data>" |
2537 svn_line = [i for i in info['body'].splitlines() if 'git-svn-id:' in i] | 2538 svn_line = [i for i in info['body'].splitlines() if 'git-svn-id:' in i] |
2538 svn_revision = svn_line[0].split('@') | 2539 svn_revision = svn_line[0].split('@') |
2539 svn_revision = svn_revision[1].split(' ')[0] | 2540 svn_revision = svn_revision[1].split(' ')[0] |
2540 return DEPOT_DEPS_NAME[depot]['viewvc'] + svn_revision | 2541 return DEPOT_DEPS_NAME[depot]['viewvc'] + svn_revision |
2541 except IndexError: | 2542 except IndexError: |
2542 return '' | 2543 return '' |
(...skipping 14 matching lines...) Expand all Loading... |
2557 'author': info['author'], | 2558 'author': info['author'], |
2558 'email_info': email_info, | 2559 'email_info': email_info, |
2559 'commit_info': commit_info, | 2560 'commit_info': commit_info, |
2560 'cl': cl, | 2561 'cl': cl, |
2561 'cl_date': info['date'] | 2562 'cl_date': info['date'] |
2562 } | 2563 } |
2563 | 2564 |
2564 def _PrintTestedCommitsHeader(self): | 2565 def _PrintTestedCommitsHeader(self): |
2565 if self.opts.bisect_mode == BISECT_MODE_MEAN: | 2566 if self.opts.bisect_mode == BISECT_MODE_MEAN: |
2566 _PrintTableRow( | 2567 _PrintTableRow( |
2567 [20, 70, 14, 12, 13], | 2568 [20, 12, 70, 14, 12, 13], |
2568 ['Depot', 'Commit SHA', 'Mean', 'Std. Error', 'State']) | 2569 ['Depot', 'Position', 'SHA', 'Mean', 'Std. Error', 'State']) |
2569 elif self.opts.bisect_mode == BISECT_MODE_STD_DEV: | 2570 elif self.opts.bisect_mode == BISECT_MODE_STD_DEV: |
2570 _PrintTableRow( | 2571 _PrintTableRow( |
2571 [20, 70, 14, 12, 13], | 2572 [20, 12, 70, 14, 12, 13], |
2572 ['Depot', 'Commit SHA', 'Std. Error', 'Mean', 'State']) | 2573 ['Depot', 'Position', 'SHA', 'Std. Error', 'Mean', 'State']) |
2573 elif self.opts.bisect_mode == BISECT_MODE_RETURN_CODE: | 2574 elif self.opts.bisect_mode == BISECT_MODE_RETURN_CODE: |
2574 _PrintTableRow( | 2575 _PrintTableRow( |
2575 [20, 70, 14, 13], | 2576 [20, 12, 70, 14, 13], |
2576 ['Depot', 'Commit SHA', 'Return Code', 'State']) | 2577 ['Depot', 'Position', 'SHA', 'Return Code', 'State']) |
2577 else: | 2578 else: |
2578 assert False, 'Invalid bisect_mode specified.' | 2579 assert False, 'Invalid bisect_mode specified.' |
2579 | 2580 |
2580 def _PrintTestedCommitsEntry(self, current_data, cl_link, state_str): | 2581 def _PrintTestedCommitsEntry(self, current_data, commit_position, cl_link, |
| 2582 state_str): |
2581 if self.opts.bisect_mode == BISECT_MODE_MEAN: | 2583 if self.opts.bisect_mode == BISECT_MODE_MEAN: |
2582 std_error = '+-%.02f' % current_data['value']['std_err'] | 2584 std_error = '+-%.02f' % current_data['value']['std_err'] |
2583 mean = '%.02f' % current_data['value']['mean'] | 2585 mean = '%.02f' % current_data['value']['mean'] |
2584 _PrintTableRow( | 2586 _PrintTableRow( |
2585 [20, 70, 12, 14, 13], | 2587 [20, 12, 70, 12, 14, 13], |
2586 [current_data['depot'], cl_link, mean, std_error, state_str]) | 2588 [current_data['depot'], commit_position, cl_link, mean, std_error, |
| 2589 state_str]) |
2587 elif self.opts.bisect_mode == BISECT_MODE_STD_DEV: | 2590 elif self.opts.bisect_mode == BISECT_MODE_STD_DEV: |
2588 std_error = '+-%.02f' % current_data['value']['std_err'] | 2591 std_error = '+-%.02f' % current_data['value']['std_err'] |
2589 mean = '%.02f' % current_data['value']['mean'] | 2592 mean = '%.02f' % current_data['value']['mean'] |
2590 _PrintTableRow( | 2593 _PrintTableRow( |
2591 [20, 70, 12, 14, 13], | 2594 [20, 12, 70, 12, 14, 13], |
2592 [current_data['depot'], cl_link, std_error, mean, state_str]) | 2595 [current_data['depot'], commit_position, cl_link, std_error, mean, |
| 2596 state_str]) |
2593 elif self.opts.bisect_mode == BISECT_MODE_RETURN_CODE: | 2597 elif self.opts.bisect_mode == BISECT_MODE_RETURN_CODE: |
2594 mean = '%d' % current_data['value']['mean'] | 2598 mean = '%d' % current_data['value']['mean'] |
2595 _PrintTableRow( | 2599 _PrintTableRow( |
2596 [20, 70, 14, 13], | 2600 [20, 12, 70, 14, 13], |
2597 [current_data['depot'], cl_link, mean, state_str]) | 2601 [current_data['depot'], commit_position, cl_link, mean, |
| 2602 state_str]) |
2598 | 2603 |
2599 def _PrintTestedCommitsTable( | 2604 def _PrintTestedCommitsTable( |
2600 self, revision_data_sorted, first_working_revision, last_broken_revision, | 2605 self, revision_data_sorted, first_working_revision, last_broken_revision, |
2601 confidence, final_step=True): | 2606 confidence, final_step=True): |
2602 print | 2607 print |
2603 if final_step: | 2608 if final_step: |
2604 print '===== TESTED COMMITS =====' | 2609 print '===== TESTED COMMITS =====' |
2605 else: | 2610 else: |
2606 print '===== PARTIAL RESULTS =====' | 2611 print '===== PARTIAL RESULTS =====' |
2607 self._PrintTestedCommitsHeader() | 2612 self._PrintTestedCommitsHeader() |
(...skipping 19 matching lines...) Expand all Loading... |
2627 | 2632 |
2628 # If confidence is too low, don't bother outputting good/bad. | 2633 # If confidence is too low, don't bother outputting good/bad. |
2629 if not confidence: | 2634 if not confidence: |
2630 state_str = '' | 2635 state_str = '' |
2631 state_str = state_str.center(13, ' ') | 2636 state_str = state_str.center(13, ' ') |
2632 | 2637 |
2633 cl_link = self._GetViewVCLinkFromDepotAndHash(current_id, | 2638 cl_link = self._GetViewVCLinkFromDepotAndHash(current_id, |
2634 current_data['depot']) | 2639 current_data['depot']) |
2635 if not cl_link: | 2640 if not cl_link: |
2636 cl_link = current_id | 2641 cl_link = current_id |
2637 self._PrintTestedCommitsEntry(current_data, cl_link, state_str) | 2642 commit_position = self.source_control.GetCommitPosition(current_id) |
| 2643 commit_position = str(commit_position) |
| 2644 if not commit_position: |
| 2645 commit_position = '' |
| 2646 self._PrintTestedCommitsEntry(current_data, commit_position, cl_link, |
| 2647 state_str) |
2638 | 2648 |
2639 def _PrintReproSteps(self): | 2649 def _PrintReproSteps(self): |
2640 """Prints out a section of the results explaining how to run the test. | 2650 """Prints out a section of the results explaining how to run the test. |
2641 | 2651 |
2642 This message includes the command used to run the test. | 2652 This message includes the command used to run the test. |
2643 """ | 2653 """ |
2644 command = '$ ' + self.opts.command | 2654 command = '$ ' + self.opts.command |
2645 if bisect_utils.IsTelemetryCommand(self.opts.command): | 2655 if bisect_utils.IsTelemetryCommand(self.opts.command): |
2646 command += ('\nAlso consider passing --profiler=list to see available ' | 2656 command += ('\nAlso consider passing --profiler=list to see available ' |
2647 'profilers.') | 2657 'profilers.') |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3167 # bugs. If you change this, please update the perf dashboard as well. | 3177 # bugs. If you change this, please update the perf dashboard as well. |
3168 bisect_utils.OutputAnnotationStepStart('Results') | 3178 bisect_utils.OutputAnnotationStepStart('Results') |
3169 print 'Error: %s' % e.message | 3179 print 'Error: %s' % e.message |
3170 if opts.output_buildbot_annotations: | 3180 if opts.output_buildbot_annotations: |
3171 bisect_utils.OutputAnnotationStepClosed() | 3181 bisect_utils.OutputAnnotationStepClosed() |
3172 return 1 | 3182 return 1 |
3173 | 3183 |
3174 | 3184 |
3175 if __name__ == '__main__': | 3185 if __name__ == '__main__': |
3176 sys.exit(main()) | 3186 sys.exit(main()) |
OLD | NEW |