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

Side by Side Diff: tools/binary_size/diagnose_bloat.py

Issue 2886793002: diagnose_bloat.py: Don't run git commands when --cloud (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | 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 2017 The Chromium Authors. All rights reserved. 2 # Copyright 2017 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 """Tool for finding the cause of binary size bloat. 6 """Tool for finding the cause of binary size bloat.
7 7
8 See //tools/binary_size/README.md for example usage. 8 See //tools/binary_size/README.md for example usage.
9 9
10 Note: this tool will perform gclient sync/git checkout on your local repo if 10 Note: this tool will perform gclient sync/git checkout on your local repo if
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 @property 226 @property
227 def download_output_dir(self): 227 def download_output_dir(self):
228 return 'out/Release' if self.IsAndroid() else 'full-build-linux' 228 return 'out/Release' if self.IsAndroid() else 'full-build-linux'
229 229
230 @property 230 @property
231 def map_file_path(self): 231 def map_file_path(self):
232 return self.main_lib_path + '.map.gz' 232 return self.main_lib_path + '.map.gz'
233 233
234 @property 234 @property
235 def size_name(self): 235 def size_name(self):
236 return os.path.splitext(os.path.basename(self.main_lib_path))[0] + '.size' 236 if self.IsLinux():
237 return os.path.basename(self.main_lib_path) + '.size'
238 return self.apk_name + '.size'
237 239
238 def _SetDefaults(self): 240 def _SetDefaults(self):
239 has_goma_dir = os.path.exists(os.path.join(os.path.expanduser('~'), 'goma')) 241 has_goma_dir = os.path.exists(os.path.join(os.path.expanduser('~'), 'goma'))
240 self.use_goma = self.use_goma or has_goma_dir 242 self.use_goma = self.use_goma or has_goma_dir
241 self.max_load_average = (self.max_load_average or 243 self.max_load_average = (self.max_load_average or
242 str(multiprocessing.cpu_count())) 244 str(multiprocessing.cpu_count()))
243 if not self.max_jobs: 245 if not self.max_jobs:
244 self.max_jobs = '10000' if self.use_goma else '500' 246 self.max_jobs = '10000' if self.use_goma else '500'
245 247
246 if os.path.exists(os.path.join(os.path.dirname(_SRC_ROOT), 'src-internal')): 248 if os.path.exists(os.path.join(os.path.dirname(_SRC_ROOT), 'src-internal')):
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 sys.exit() 754 sys.exit()
753 args = parser.parse_args() 755 args = parser.parse_args()
754 log_level = logging.DEBUG if args.verbose else logging.INFO 756 log_level = logging.DEBUG if args.verbose else logging.INFO
755 logging.basicConfig(level=log_level, 757 logging.basicConfig(level=log_level,
756 format='%(levelname).1s %(relativeCreated)6d %(message)s') 758 format='%(levelname).1s %(relativeCreated)6d %(message)s')
757 build = _BuildHelper(args) 759 build = _BuildHelper(args)
758 if build.IsCloud() and args.subrepo: 760 if build.IsCloud() and args.subrepo:
759 parser.error('--subrepo doesn\'t work with --cloud') 761 parser.error('--subrepo doesn\'t work with --cloud')
760 762
761 subrepo = args.subrepo or _SRC_ROOT 763 subrepo = args.subrepo or _SRC_ROOT
762 _EnsureDirectoryClean(subrepo) 764 if not build.IsCloud():
763 _SetRestoreFunc(subrepo) 765 _EnsureDirectoryClean(subrepo)
766 _SetRestoreFunc(subrepo)
767
764 if build.IsLinux(): 768 if build.IsLinux():
765 _VerifyUserAccepts('Linux diffs have known deficiencies (crbug/717550).') 769 _VerifyUserAccepts('Linux diffs have known deficiencies (crbug/717550).')
766 770
767 rev, reference_rev = _ValidateRevs( 771 rev, reference_rev = _ValidateRevs(
768 args.rev, args.reference_rev or args.rev + '^', subrepo) 772 args.rev, args.reference_rev or args.rev + '^', subrepo)
769 revs = _GenerateRevList(rev, reference_rev, args.all, subrepo) 773 revs = _GenerateRevList(rev, reference_rev, args.all, subrepo)
770 with _TmpCopyBinarySizeDir() as supersize_path: 774 with _TmpCopyBinarySizeDir() as supersize_path:
771 diffs = [NativeDiff(build.size_name, supersize_path)] 775 diffs = [NativeDiff(build.size_name, supersize_path)]
772 if build.IsAndroid(): 776 if build.IsAndroid():
773 diffs += [ 777 diffs += [
(...skipping 28 matching lines...) Expand all
802 806
803 if i != 0: 807 if i != 0:
804 diff_mngr.MaybeDiff(i - 1, i) 808 diff_mngr.MaybeDiff(i - 1, i)
805 809
806 diff_mngr.Summarize() 810 diff_mngr.Summarize()
807 811
808 812
809 if __name__ == '__main__': 813 if __name__ == '__main__':
810 sys.exit(main()) 814 sys.exit(main())
811 815
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698