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 2618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 confidence_status = 'Successful with %(level)s confidence%(warning)s.' | 2629 confidence_status = 'Successful with %(level)s confidence%(warning)s.' |
2630 if results_dict['confidence'] >= HIGH_CONFIDENCE: | 2630 if results_dict['confidence'] >= HIGH_CONFIDENCE: |
2631 level = 'high' | 2631 level = 'high' |
2632 else: | 2632 else: |
2633 level = 'low' | 2633 level = 'low' |
2634 warning = ' and warnings' | 2634 warning = ' and warnings' |
2635 if not self.warnings: | 2635 if not self.warnings: |
2636 warning = '' | 2636 warning = '' |
2637 return confidence_status % {'level': level, 'warning': warning} | 2637 return confidence_status % {'level': level, 'warning': warning} |
2638 | 2638 |
2639 def _GetViewVCLinkFromDepotAndHash(self, revision_id, depot): | 2639 def _GetViewVCLinkFromDepotAndHash(self, cl, depot): |
2640 """Gets link to the repository browser.""" | 2640 info = self.source_control.QueryRevisionInfo(cl, |
2641 info = self.source_control.QueryRevisionInfo( | 2641 self._GetDepotDirectory(depot)) |
2642 revision_id, self._GetDepotDirectory(depot)) | |
2643 if depot and DEPOT_DEPS_NAME[depot].has_key('viewvc'): | 2642 if depot and DEPOT_DEPS_NAME[depot].has_key('viewvc'): |
2644 try: | 2643 try: |
2645 # Format is "git-svn-id: svn://....@123456 <other data>" | 2644 # Format is "git-svn-id: svn://....@123456 <other data>" |
2646 svn_line = [i for i in info['body'].splitlines() if 'git-svn-id:' in i] | 2645 svn_line = [i for i in info['body'].splitlines() if 'git-svn-id:' in i] |
2647 svn_revision = svn_line[0].split('@') | 2646 svn_revision = svn_line[0].split('@') |
2648 svn_revision = svn_revision[1].split(' ')[0] | 2647 svn_revision = svn_revision[1].split(' ')[0] |
2649 return DEPOT_DEPS_NAME[depot]['viewvc'] + svn_revision | 2648 return DEPOT_DEPS_NAME[depot]['viewvc'] + svn_revision |
2650 except IndexError: | 2649 except IndexError: |
2651 return '' | 2650 return '' |
2652 return '' | 2651 return '' |
(...skipping 13 matching lines...) Expand all Loading... |
2666 'author': info['author'], | 2665 'author': info['author'], |
2667 'email_info': email_info, | 2666 'email_info': email_info, |
2668 'commit_info': commit_info, | 2667 'commit_info': commit_info, |
2669 'cl': cl, | 2668 'cl': cl, |
2670 'cl_date': info['date'] | 2669 'cl_date': info['date'] |
2671 } | 2670 } |
2672 | 2671 |
2673 def _PrintTestedCommitsHeader(self): | 2672 def _PrintTestedCommitsHeader(self): |
2674 if self.opts.bisect_mode == BISECT_MODE_MEAN: | 2673 if self.opts.bisect_mode == BISECT_MODE_MEAN: |
2675 _PrintTableRow( | 2674 _PrintTableRow( |
2676 [20, 12, 70, 14, 12, 13], | 2675 [20, 70, 14, 12, 13], |
2677 ['Depot', 'Position', 'SHA', 'Mean', 'Std. Error', 'State']) | 2676 ['Depot', 'Commit SHA', 'Mean', 'Std. Error', 'State']) |
2678 elif self.opts.bisect_mode == BISECT_MODE_STD_DEV: | 2677 elif self.opts.bisect_mode == BISECT_MODE_STD_DEV: |
2679 _PrintTableRow( | 2678 _PrintTableRow( |
2680 [20, 12, 70, 14, 12, 13], | 2679 [20, 70, 14, 12, 13], |
2681 ['Depot', 'Position', 'SHA', 'Std. Error', 'Mean', 'State']) | 2680 ['Depot', 'Commit SHA', 'Std. Error', 'Mean', 'State']) |
2682 elif self.opts.bisect_mode == BISECT_MODE_RETURN_CODE: | 2681 elif self.opts.bisect_mode == BISECT_MODE_RETURN_CODE: |
2683 _PrintTableRow( | 2682 _PrintTableRow( |
2684 [20, 12, 70, 14, 13], | 2683 [20, 70, 14, 13], |
2685 ['Depot', 'Position', 'SHA', 'Return Code', 'State']) | 2684 ['Depot', 'Commit SHA', 'Return Code', 'State']) |
2686 else: | 2685 else: |
2687 assert False, 'Invalid bisect_mode specified.' | 2686 assert False, 'Invalid bisect_mode specified.' |
2688 | 2687 |
2689 def _PrintTestedCommitsEntry(self, current_data, commit_position, cl_link, | 2688 def _PrintTestedCommitsEntry(self, current_data, cl_link, state_str): |
2690 state_str): | |
2691 if self.opts.bisect_mode == BISECT_MODE_MEAN: | 2689 if self.opts.bisect_mode == BISECT_MODE_MEAN: |
2692 std_error = '+-%.02f' % current_data['value']['std_err'] | 2690 std_error = '+-%.02f' % current_data['value']['std_err'] |
2693 mean = '%.02f' % current_data['value']['mean'] | 2691 mean = '%.02f' % current_data['value']['mean'] |
2694 _PrintTableRow( | 2692 _PrintTableRow( |
2695 [20, 12, 70, 12, 14, 13], | 2693 [20, 70, 12, 14, 13], |
2696 [current_data['depot'], commit_position, cl_link, mean, std_error, | 2694 [current_data['depot'], cl_link, mean, std_error, state_str]) |
2697 state_str]) | |
2698 elif self.opts.bisect_mode == BISECT_MODE_STD_DEV: | 2695 elif self.opts.bisect_mode == BISECT_MODE_STD_DEV: |
2699 std_error = '+-%.02f' % current_data['value']['std_err'] | 2696 std_error = '+-%.02f' % current_data['value']['std_err'] |
2700 mean = '%.02f' % current_data['value']['mean'] | 2697 mean = '%.02f' % current_data['value']['mean'] |
2701 _PrintTableRow( | 2698 _PrintTableRow( |
2702 [20, 12, 70, 12, 14, 13], | 2699 [20, 70, 12, 14, 13], |
2703 [current_data['depot'], commit_position, cl_link, std_error, mean, | 2700 [current_data['depot'], cl_link, std_error, mean, state_str]) |
2704 state_str]) | |
2705 elif self.opts.bisect_mode == BISECT_MODE_RETURN_CODE: | 2701 elif self.opts.bisect_mode == BISECT_MODE_RETURN_CODE: |
2706 mean = '%d' % current_data['value']['mean'] | 2702 mean = '%d' % current_data['value']['mean'] |
2707 _PrintTableRow( | 2703 _PrintTableRow( |
2708 [20, 12, 70, 14, 13], | 2704 [20, 70, 14, 13], |
2709 [current_data['depot'], commit_position, cl_link, mean, | 2705 [current_data['depot'], cl_link, mean, state_str]) |
2710 state_str]) | |
2711 | 2706 |
2712 def _PrintTestedCommitsTable( | 2707 def _PrintTestedCommitsTable( |
2713 self, revision_data_sorted, first_working_revision, last_broken_revision, | 2708 self, revision_data_sorted, first_working_revision, last_broken_revision, |
2714 confidence, final_step=True): | 2709 confidence, final_step=True): |
2715 print | 2710 print |
2716 if final_step: | 2711 if final_step: |
2717 print '===== TESTED COMMITS =====' | 2712 print '===== TESTED COMMITS =====' |
2718 else: | 2713 else: |
2719 print '===== PARTIAL RESULTS =====' | 2714 print '===== PARTIAL RESULTS =====' |
2720 self._PrintTestedCommitsHeader() | 2715 self._PrintTestedCommitsHeader() |
(...skipping 19 matching lines...) Expand all Loading... |
2740 | 2735 |
2741 # If confidence is too low, don't bother outputting good/bad. | 2736 # If confidence is too low, don't bother outputting good/bad. |
2742 if not confidence: | 2737 if not confidence: |
2743 state_str = '' | 2738 state_str = '' |
2744 state_str = state_str.center(13, ' ') | 2739 state_str = state_str.center(13, ' ') |
2745 | 2740 |
2746 cl_link = self._GetViewVCLinkFromDepotAndHash(current_id, | 2741 cl_link = self._GetViewVCLinkFromDepotAndHash(current_id, |
2747 current_data['depot']) | 2742 current_data['depot']) |
2748 if not cl_link: | 2743 if not cl_link: |
2749 cl_link = current_id | 2744 cl_link = current_id |
2750 commit_position = self.source_control.GetCommitPosition(current_id) | 2745 self._PrintTestedCommitsEntry(current_data, cl_link, state_str) |
2751 self._PrintTestedCommitsEntry(current_data, commit_position, cl_link, | |
2752 state_str) | |
2753 | 2746 |
2754 def _PrintReproSteps(self): | 2747 def _PrintReproSteps(self): |
2755 """Prints out a section of the results explaining how to run the test. | 2748 """Prints out a section of the results explaining how to run the test. |
2756 | 2749 |
2757 This message includes the command used to run the test. | 2750 This message includes the command used to run the test. |
2758 """ | 2751 """ |
2759 command = '$ ' + self.opts.command | 2752 command = '$ ' + self.opts.command |
2760 if bisect_utils.IsTelemetryCommand(self.opts.command): | 2753 if bisect_utils.IsTelemetryCommand(self.opts.command): |
2761 command += ('\nAlso consider passing --profiler=list to see available ' | 2754 command += ('\nAlso consider passing --profiler=list to see available ' |
2762 'profilers.') | 2755 'profilers.') |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3404 # bugs. If you change this, please update the perf dashboard as well. | 3397 # bugs. If you change this, please update the perf dashboard as well. |
3405 bisect_utils.OutputAnnotationStepStart('Results') | 3398 bisect_utils.OutputAnnotationStepStart('Results') |
3406 print 'Error: %s' % e.message | 3399 print 'Error: %s' % e.message |
3407 if opts.output_buildbot_annotations: | 3400 if opts.output_buildbot_annotations: |
3408 bisect_utils.OutputAnnotationStepClosed() | 3401 bisect_utils.OutputAnnotationStepClosed() |
3409 return 1 | 3402 return 1 |
3410 | 3403 |
3411 | 3404 |
3412 if __name__ == '__main__': | 3405 if __name__ == '__main__': |
3413 sys.exit(main()) | 3406 sys.exit(main()) |
OLD | NEW |