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

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

Issue 14265008: Delete webkit directory on initial sync as well. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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
« no previous file with comments | « no previous file | tools/bisect_utils.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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 'skia/gyp' : { 94 'skia/gyp' : {
95 "src" : "src/third_party/skia/gyp", 95 "src" : "src/third_party/skia/gyp",
96 "recurse" : False, 96 "recurse" : False,
97 "svn" : "http://skia.googlecode.com/svn/trunk/gyp", 97 "svn" : "http://skia.googlecode.com/svn/trunk/gyp",
98 "depends" : None 98 "depends" : None
99 } 99 }
100 } 100 }
101 101
102 DEPOT_NAMES = DEPOT_DEPS_NAME.keys() 102 DEPOT_NAMES = DEPOT_DEPS_NAME.keys()
103 103
104 FILE_DEPS_GIT = '.DEPS.git'
105 104
106 105
107 def CalculateTruncatedMean(data_set, truncate_percent): 106 def CalculateTruncatedMean(data_set, truncate_percent):
108 """Calculates the truncated mean of a set of values. 107 """Calculates the truncated mean of a set of values.
109 108
110 Args: 109 Args:
111 data_set: Set of values to use in calculation. 110 data_set: Set of values to use in calculation.
112 truncate_percent: The % from the upper/lower portions of the data set to 111 truncate_percent: The % from the upper/lower portions of the data set to
113 discard, expressed as a value in [0, 1]. 112 discard, expressed as a value in [0, 1].
114 113
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 """ 483 """
485 return not RunGit(['checkout', revision, file_name])[1] 484 return not RunGit(['checkout', revision, file_name])[1]
486 485
487 def RevertFileToHead(self, file_name): 486 def RevertFileToHead(self, file_name):
488 """Unstages a file and returns it to HEAD. 487 """Unstages a file and returns it to HEAD.
489 488
490 Returns: 489 Returns:
491 True if successful. 490 True if successful.
492 """ 491 """
493 # Reset doesn't seem to return 0 on success. 492 # Reset doesn't seem to return 0 on success.
494 RunGit(['reset', 'HEAD', FILE_DEPS_GIT]) 493 RunGit(['reset', 'HEAD', bisect_utils.FILE_DEPS_GIT])
495 494
496 return not RunGit(['checkout', FILE_DEPS_GIT])[1] 495 return not RunGit(['checkout', bisect_utils.FILE_DEPS_GIT])[1]
497 496
498 class BisectPerformanceMetrics(object): 497 class BisectPerformanceMetrics(object):
499 """BisectPerformanceMetrics performs a bisection against a list of range 498 """BisectPerformanceMetrics performs a bisection against a list of range
500 of revisions to narrow down where performance regressions may have 499 of revisions to narrow down where performance regressions may have
501 occurred.""" 500 occurred."""
502 501
503 def __init__(self, source_control, opts): 502 def __init__(self, source_control, opts):
504 super(BisectPerformanceMetrics, self).__init__() 503 super(BisectPerformanceMetrics, self).__init__()
505 504
506 self.opts = opts 505 self.opts = opts
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 540
542 Returns: 541 Returns:
543 A dict in the format {depot:revision} if successful, otherwise None. 542 A dict in the format {depot:revision} if successful, otherwise None.
544 """ 543 """
545 544
546 cwd = os.getcwd() 545 cwd = os.getcwd()
547 os.chdir(self.src_cwd) 546 os.chdir(self.src_cwd)
548 547
549 locals = {'Var': lambda _: locals["vars"][_], 548 locals = {'Var': lambda _: locals["vars"][_],
550 'From': lambda *args: None} 549 'From': lambda *args: None}
551 execfile(FILE_DEPS_GIT, {}, locals) 550 execfile(bisect_utils.FILE_DEPS_GIT, {}, locals)
552 551
553 os.chdir(cwd) 552 os.chdir(cwd)
554 553
555 results = {} 554 results = {}
556 555
557 rxp = re.compile(".git@(?P<revision>[a-fA-F0-9]+)") 556 rxp = re.compile(".git@(?P<revision>[a-fA-F0-9]+)")
558 557
559 for d in DEPOT_NAMES: 558 for d in DEPOT_NAMES:
560 if DEPOT_DEPS_NAME[d]['recurse']: 559 if DEPOT_DEPS_NAME[d]['recurse']:
561 if locals['deps'].has_key(DEPOT_DEPS_NAME[d]['src']): 560 if locals['deps'].has_key(DEPOT_DEPS_NAME[d]['src']):
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 787
789 def PerformWebkitDirectoryCleanup(self, revision): 788 def PerformWebkitDirectoryCleanup(self, revision):
790 """If the script is switching between Blink and WebKit during bisect, 789 """If the script is switching between Blink and WebKit during bisect,
791 its faster to just delete the directory rather than leave it up to git 790 its faster to just delete the directory rather than leave it up to git
792 to sync. 791 to sync.
793 792
794 Returns: 793 Returns:
795 True if successful. 794 True if successful.
796 """ 795 """
797 if not self.source_control.CheckoutFileAtRevision( 796 if not self.source_control.CheckoutFileAtRevision(
798 FILE_DEPS_GIT, revision): 797 bisect_utils.FILE_DEPS_GIT, revision):
799 return False 798 return False
800 799
801 cwd = os.getcwd() 800 cwd = os.getcwd()
802 os.chdir(self.src_cwd) 801 os.chdir(self.src_cwd)
803 802
804 locals = {'Var': lambda _: locals["vars"][_], 803 is_blink = bisect_utils.IsDepsFileBlink()
805 'From': lambda *args: None}
806 execfile(FILE_DEPS_GIT, {}, locals)
807 804
808 os.chdir(cwd) 805 os.chdir(cwd)
809 806
810 is_blink = 'blink.git' in locals['vars']['webkit_url'] 807 if not self.source_control.RevertFileToHead(
811 808 bisect_utils.FILE_DEPS_GIT):
812 if not self.source_control.RevertFileToHead(FILE_DEPS_GIT):
813 return False 809 return False
814 810
815 if self.was_blink != is_blink: 811 if self.was_blink != is_blink:
816 self.was_blink = is_blink 812 self.was_blink = is_blink
817 try: 813 return bisect_utils.RemoveThirdPartyWebkitDirectory()
818 path_to_dir = os.path.join(os.getcwd(), 'third_party', 'WebKit')
819 if os.path.exists(path_to_dir):
820 shutil.rmtree(path_to_dir)
821 except OSError, e:
822 if e.errno != errno.ENOENT:
823 return False
824 return True 814 return True
825 815
826 def PerformPreSyncCleanup(self, revision, depot): 816 def PerformPreSyncCleanup(self, revision, depot):
827 """Performs any necessary cleanup before syncing. 817 """Performs any necessary cleanup before syncing.
828 818
829 Returns: 819 Returns:
830 True if successful. 820 True if successful.
831 """ 821 """
832 if depot == 'chromium': 822 if depot == 'chromium':
833 return self.PerformWebkitDirectoryCleanup(revision) 823 return self.PerformWebkitDirectoryCleanup(revision)
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 1728
1739 if not(bisect_results['error']): 1729 if not(bisect_results['error']):
1740 return 0 1730 return 0
1741 else: 1731 else:
1742 print 'Error: ' + bisect_results['error'] 1732 print 'Error: ' + bisect_results['error']
1743 print 1733 print
1744 return 1 1734 return 1
1745 1735
1746 if __name__ == '__main__': 1736 if __name__ == '__main__':
1747 sys.exit(main()) 1737 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | tools/bisect_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698