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