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

Side by Side Diff: tools/bisect-perf-regression.py

Issue 277993002: Add target_build_type flag to bisect-perf-regression tool to enable bisecting of a Debug build with… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « tools/bisect-manual-test.py ('k') | tools/run-bisect-manual-test.py » ('j') | 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) 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 if IsWindows(): 647 if IsWindows():
648 os.environ['GYP_DEFINES'] = 'component=shared_library '\ 648 os.environ['GYP_DEFINES'] = 'component=shared_library '\
649 'incremental_chrome_dll=1 disable_nacl=1 fastbuild=1 '\ 649 'incremental_chrome_dll=1 disable_nacl=1 fastbuild=1 '\
650 'chromium_win_pch=0' 650 'chromium_win_pch=0'
651 elif build_system == 'make': 651 elif build_system == 'make':
652 os.environ['GYP_GENERATORS'] = 'make' 652 os.environ['GYP_GENERATORS'] = 'make'
653 else: 653 else:
654 raise RuntimeError('%s build not supported.' % build_system) 654 raise RuntimeError('%s build not supported.' % build_system)
655 655
656 656
657 def BuildWithMake(threads, targets): 657 def BuildWithMake(threads, targets, build_type):
658 cmd = ['make', 'BUILDTYPE=Release'] 658 cmd = ['make', 'BUILDTYPE=%s' % build_type]
659 659
660 if threads: 660 if threads:
661 cmd.append('-j%d' % threads) 661 cmd.append('-j%d' % threads)
662 662
663 cmd += targets 663 cmd += targets
664 664
665 return_code = RunProcess(cmd) 665 return_code = RunProcess(cmd)
666 666
667 return not return_code 667 return not return_code
668 668
669 669
670 def BuildWithNinja(threads, targets): 670 def BuildWithNinja(threads, targets, build_type):
671 cmd = ['ninja', '-C', os.path.join('out', 'Release')] 671 cmd = ['ninja', '-C', os.path.join('out', build_type)]
672 672
673 if threads: 673 if threads:
674 cmd.append('-j%d' % threads) 674 cmd.append('-j%d' % threads)
675 675
676 cmd += targets 676 cmd += targets
677 677
678 return_code = RunProcess(cmd) 678 return_code = RunProcess(cmd)
679 679
680 return not return_code 680 return not return_code
681 681
682 682
683 def BuildWithVisualStudio(targets): 683 def BuildWithVisualStudio(targets, build_type):
684 path_to_devenv = os.path.abspath( 684 path_to_devenv = os.path.abspath(
685 os.path.join(os.environ['VS100COMNTOOLS'], '..', 'IDE', 'devenv.com')) 685 os.path.join(os.environ['VS100COMNTOOLS'], '..', 'IDE', 'devenv.com'))
686 path_to_sln = os.path.join(os.getcwd(), 'chrome', 'chrome.sln') 686 path_to_sln = os.path.join(os.getcwd(), 'chrome', 'chrome.sln')
687 cmd = [path_to_devenv, '/build', 'Release', path_to_sln] 687 cmd = [path_to_devenv, '/build', build_type, path_to_sln]
688 688
689 for t in targets: 689 for t in targets:
690 cmd.extend(['/Project', t]) 690 cmd.extend(['/Project', t])
691 691
692 return_code = RunProcess(cmd) 692 return_code = RunProcess(cmd)
693 693
694 return not return_code 694 return not return_code
695 695
696 696
697 def WriteStringToFile(text, file_name): 697 def WriteStringToFile(text, file_name):
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 True if build was successful. 790 True if build was successful.
791 """ 791 """
792 targets = ['chromium_builder_perf'] 792 targets = ['chromium_builder_perf']
793 793
794 threads = None 794 threads = None
795 if opts.use_goma: 795 if opts.use_goma:
796 threads = 64 796 threads = 64
797 797
798 build_success = False 798 build_success = False
799 if opts.build_preference == 'make': 799 if opts.build_preference == 'make':
800 build_success = BuildWithMake(threads, targets) 800 build_success = BuildWithMake(threads, targets, opts.target_build_type)
801 elif opts.build_preference == 'ninja': 801 elif opts.build_preference == 'ninja':
802 build_success = BuildWithNinja(threads, targets) 802 build_success = BuildWithNinja(threads, targets, opts.target_build_type)
803 elif opts.build_preference == 'msvs': 803 elif opts.build_preference == 'msvs':
804 assert IsWindows(), 'msvs is only supported on Windows.' 804 assert IsWindows(), 'msvs is only supported on Windows.'
805 build_success = BuildWithVisualStudio(targets) 805 build_success = BuildWithVisualStudio(targets, opts.target_build_type)
806 else: 806 else:
807 assert False, 'No build system defined.' 807 assert False, 'No build system defined.'
808 return build_success 808 return build_success
809 809
810 def GetBuildOutputDirectory(self, opts, src_dir=None): 810 def GetBuildOutputDirectory(self, opts, src_dir=None):
811 """Returns the path to the build directory, relative to the checkout root. 811 """Returns the path to the build directory, relative to the checkout root.
812 812
813 Assumes that the current working directory is the checkout root. 813 Assumes that the current working directory is the checkout root.
814 """ 814 """
815 src_dir = src_dir or 'src' 815 src_dir = src_dir or 'src'
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 905
906 if depot != 'cros': 906 if depot != 'cros':
907 path_to_chrome = os.path.join(os.getcwd(), '..') 907 path_to_chrome = os.path.join(os.getcwd(), '..')
908 cmd += ['--chrome_root=%s' % path_to_chrome] 908 cmd += ['--chrome_root=%s' % path_to_chrome]
909 909
910 cmd += ['--'] 910 cmd += ['--']
911 911
912 if depot != 'cros': 912 if depot != 'cros':
913 cmd += ['CHROME_ORIGIN=LOCAL_SOURCE'] 913 cmd += ['CHROME_ORIGIN=LOCAL_SOURCE']
914 914
915 cmd += ['BUILDTYPE=Release', './build_packages', 915 cmd += ['BUILDTYPE=%s' % opts.target_build_type, './build_packages',
916 '--board=%s' % opts.cros_board] 916 '--board=%s' % opts.cros_board]
917 return_code = RunProcess(cmd) 917 return_code = RunProcess(cmd)
918 918
919 return not return_code 919 return not return_code
920 920
921 def BuildImage(self, opts, depot): 921 def BuildImage(self, opts, depot):
922 """Builds test image for cros. 922 """Builds test image for cros.
923 923
924 Args: 924 Args:
925 opts: Program options containing cros_board. 925 opts: Program options containing cros_board.
926 depot: The depot being bisected. 926 depot: The depot being bisected.
927 927
928 Returns: 928 Returns:
929 True if successful. 929 True if successful.
930 """ 930 """
931 cmd = [CROS_SDK_PATH] 931 cmd = [CROS_SDK_PATH]
932 932
933 if depot != 'cros': 933 if depot != 'cros':
934 path_to_chrome = os.path.join(os.getcwd(), '..') 934 path_to_chrome = os.path.join(os.getcwd(), '..')
935 cmd += ['--chrome_root=%s' % path_to_chrome] 935 cmd += ['--chrome_root=%s' % path_to_chrome]
936 936
937 cmd += ['--'] 937 cmd += ['--']
938 938
939 if depot != 'cros': 939 if depot != 'cros':
940 cmd += ['CHROME_ORIGIN=LOCAL_SOURCE'] 940 cmd += ['CHROME_ORIGIN=LOCAL_SOURCE']
941 941
942 cmd += ['BUILDTYPE=Release', '--', './build_image', 942 cmd += ['BUILDTYPE=%s' % opts.target_build_type, '--', './build_image',
943 '--board=%s' % opts.cros_board, 'test'] 943 '--board=%s' % opts.cros_board, 'test']
944 944
945 return_code = RunProcess(cmd) 945 return_code = RunProcess(cmd)
946 946
947 return not return_code 947 return not return_code
948 948
949 def Build(self, depot, opts): 949 def Build(self, depot, opts):
950 """Builds targets using options passed into the script. 950 """Builds targets using options passed into the script.
951 951
952 Args: 952 Args:
(...skipping 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after
3546 except OSError, e: 3546 except OSError, e:
3547 if e.errno != errno.ENOENT: 3547 if e.errno != errno.ENOENT:
3548 return False 3548 return False
3549 3549
3550 if not skip_makedir: 3550 if not skip_makedir:
3551 return MaybeMakeDirectory(path_to_dir) 3551 return MaybeMakeDirectory(path_to_dir)
3552 3552
3553 return True 3553 return True
3554 3554
3555 3555
3556 def RemoveBuildFiles(): 3556 def RemoveBuildFiles(build_type):
3557 """Removes build files from previous runs.""" 3557 """Removes build files from previous runs."""
3558 if RmTreeAndMkDir(os.path.join('out', 'Release')): 3558 if RmTreeAndMkDir(os.path.join('out', build_type)):
3559 if RmTreeAndMkDir(os.path.join('build', 'Release')): 3559 if RmTreeAndMkDir(os.path.join('build', build_type)):
3560 return True 3560 return True
3561 return False 3561 return False
3562 3562
3563 3563
3564 class BisectOptions(object): 3564 class BisectOptions(object):
3565 """Options to be used when running bisection.""" 3565 """Options to be used when running bisection."""
3566 def __init__(self): 3566 def __init__(self):
3567 super(BisectOptions, self).__init__() 3567 super(BisectOptions, self).__init__()
3568 3568
3569 self.target_platform = 'chromium' 3569 self.target_platform = 'chromium'
(...skipping 10 matching lines...) Expand all
3580 self.command = None 3580 self.command = None
3581 self.output_buildbot_annotations = None 3581 self.output_buildbot_annotations = None
3582 self.no_custom_deps = False 3582 self.no_custom_deps = False
3583 self.working_directory = None 3583 self.working_directory = None
3584 self.extra_src = None 3584 self.extra_src = None
3585 self.debug_ignore_build = None 3585 self.debug_ignore_build = None
3586 self.debug_ignore_sync = None 3586 self.debug_ignore_sync = None
3587 self.debug_ignore_perf_test = None 3587 self.debug_ignore_perf_test = None
3588 self.gs_bucket = None 3588 self.gs_bucket = None
3589 self.target_arch = 'ia32' 3589 self.target_arch = 'ia32'
3590 self.target_build_type = 'Release'
3590 self.builder_host = None 3591 self.builder_host = None
3591 self.builder_port = None 3592 self.builder_port = None
3592 self.bisect_mode = BISECT_MODE_MEAN 3593 self.bisect_mode = BISECT_MODE_MEAN
3593 3594
3594 def _CreateCommandLineParser(self): 3595 def _CreateCommandLineParser(self):
3595 """Creates a parser with bisect options. 3596 """Creates a parser with bisect options.
3596 3597
3597 Returns: 3598 Returns:
3598 An instance of optparse.OptionParser. 3599 An instance of optparse.OptionParser.
3599 """ 3600 """
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3703 type='str', 3704 type='str',
3704 help=('Name of Google Storage bucket to upload or ' 3705 help=('Name of Google Storage bucket to upload or '
3705 'download build. e.g., chrome-perf')) 3706 'download build. e.g., chrome-perf'))
3706 group.add_option('--target_arch', 3707 group.add_option('--target_arch',
3707 type='choice', 3708 type='choice',
3708 choices=['ia32', 'x64', 'arm'], 3709 choices=['ia32', 'x64', 'arm'],
3709 default='ia32', 3710 default='ia32',
3710 dest='target_arch', 3711 dest='target_arch',
3711 help=('The target build architecture. Choices are "ia32" ' 3712 help=('The target build architecture. Choices are "ia32" '
3712 '(default), "x64" or "arm".')) 3713 '(default), "x64" or "arm".'))
3714 group.add_option('--target_build_type',
3715 type='choice',
3716 choices=['Release', 'Debug'],
3717 default='Release',
3718 help='The target build type. Choices are "Release" '
3719 '(default), or "Debug".')
3713 group.add_option('--builder_host', 3720 group.add_option('--builder_host',
3714 dest='builder_host', 3721 dest='builder_host',
3715 type='str', 3722 type='str',
3716 help=('Host address of server to produce build by posting' 3723 help=('Host address of server to produce build by posting'
3717 ' try job request.')) 3724 ' try job request.'))
3718 group.add_option('--builder_port', 3725 group.add_option('--builder_port',
3719 dest='builder_port', 3726 dest='builder_port',
3720 type='int', 3727 type='int',
3721 help=('HTTP port of the server to produce build by posting' 3728 help=('HTTP port of the server to produce build by posting'
3722 ' try job request.')) 3729 ' try job request.'))
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
3841 _AddAdditionalDepotInfo(extra_src.GetAdditionalDepotInfo()) 3848 _AddAdditionalDepotInfo(extra_src.GetAdditionalDepotInfo())
3842 3849
3843 if opts.working_directory: 3850 if opts.working_directory:
3844 custom_deps = bisect_utils.DEFAULT_GCLIENT_CUSTOM_DEPS 3851 custom_deps = bisect_utils.DEFAULT_GCLIENT_CUSTOM_DEPS
3845 if opts.no_custom_deps: 3852 if opts.no_custom_deps:
3846 custom_deps = None 3853 custom_deps = None
3847 bisect_utils.CreateBisectDirectoryAndSetupDepot(opts, custom_deps) 3854 bisect_utils.CreateBisectDirectoryAndSetupDepot(opts, custom_deps)
3848 3855
3849 os.chdir(os.path.join(os.getcwd(), 'src')) 3856 os.chdir(os.path.join(os.getcwd(), 'src'))
3850 3857
3851 if not RemoveBuildFiles(): 3858 if not RemoveBuildFiles(opts.target_build_type):
3852 raise RuntimeError('Something went wrong removing the build files.') 3859 raise RuntimeError('Something went wrong removing the build files.')
3853 3860
3854 if not IsPlatformSupported(opts): 3861 if not IsPlatformSupported(opts):
3855 raise RuntimeError("Sorry, this platform isn't supported yet.") 3862 raise RuntimeError("Sorry, this platform isn't supported yet.")
3856 3863
3857 # Check what source control method they're using. Only support git workflow 3864 # Check what source control method they're using. Only support git workflow
3858 # at the moment. 3865 # at the moment.
3859 source_control = DetermineAndCreateSourceControl(opts) 3866 source_control = DetermineAndCreateSourceControl(opts)
3860 3867
3861 if not source_control: 3868 if not source_control:
(...skipping 22 matching lines...) Expand all
3884 # The perf dashboard scrapes the "results" step in order to comment on 3891 # The perf dashboard scrapes the "results" step in order to comment on
3885 # bugs. If you change this, please update the perf dashboard as well. 3892 # bugs. If you change this, please update the perf dashboard as well.
3886 bisect_utils.OutputAnnotationStepStart('Results') 3893 bisect_utils.OutputAnnotationStepStart('Results')
3887 print 'Error: %s' % e.message 3894 print 'Error: %s' % e.message
3888 if opts.output_buildbot_annotations: 3895 if opts.output_buildbot_annotations:
3889 bisect_utils.OutputAnnotationStepClosed() 3896 bisect_utils.OutputAnnotationStepClosed()
3890 return 1 3897 return 1
3891 3898
3892 if __name__ == '__main__': 3899 if __name__ == '__main__':
3893 sys.exit(main()) 3900 sys.exit(main())
OLDNEW
« no previous file with comments | « tools/bisect-manual-test.py ('k') | tools/run-bisect-manual-test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698