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

Unified Diff: tools/binary_size/diagnose_bloat.py

Issue 2871143004: diagnose_bloat.py: swap --silent with --verbose. (Closed)
Patch Set: Add IsAndroid to enable_chrome_android_internal 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/binary_size/README.md ('k') | tools/binary_size/libsupersize/describe.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/binary_size/diagnose_bloat.py
diff --git a/tools/binary_size/diagnose_bloat.py b/tools/binary_size/diagnose_bloat.py
index fe1a3f5db2b7f39662cb40eecf28030d98f872ba..9ec641ab1035fe74d920fcc043075730816d761d 100755
--- a/tools/binary_size/diagnose_bloat.py
+++ b/tools/binary_size/diagnose_bloat.py
@@ -3,9 +3,12 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Tool for finding the cause of APK bloat.
+"""Tool for finding the cause of binary size bloat.
-Run diagnose_apk_bloat.py -h for detailed usage help.
+See //tools/binary_size/README.md for example usage.
+
+Note: this tool will perform gclient sync/git checkout on your local repo if
+you don't use the --cloud option.
"""
import atexit
@@ -27,8 +30,6 @@ import zipfile
_COMMIT_COUNT_WARN_THRESHOLD = 15
_ALLOWED_CONSECUTIVE_FAILURES = 2
_DIFF_DETAILS_LINES_THRESHOLD = 100
-_BUILDER_URL = \
- 'https://build.chromium.org/p/chromium.perf/builders/Android%20Builder'
_SRC_ROOT = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
_DEFAULT_ARCHIVE_DIR = os.path.join(_SRC_ROOT, 'binary-size-bloat')
@@ -213,6 +214,11 @@ class _BuildHelper(object):
def abs_main_lib_path(self):
return os.path.join(self.output_directory, self.main_lib_path)
+ @property
+ def builder_url(self):
+ url = 'https://build.chromium.org/p/chromium.perf/builders/%s%%20Builder'
+ return url % self.target_os.title()
+
@property
def download_bucket(self):
return 'gs://chrome-perf/%s Builder/' % self.target_os.title()
@@ -248,8 +254,9 @@ class _BuildHelper(object):
gn_args = 'is_official_build=true symbol_level=1'
gn_args += ' use_goma=%s' % str(self.use_goma).lower()
gn_args += ' target_os="%s"' % self.target_os
- gn_args += (' enable_chrome_android_internal=%s' %
- str(self.enable_chrome_android_internal).lower())
+ if self.IsAndroid():
+ gn_args += (' enable_chrome_android_internal=%s' %
+ str(self.enable_chrome_android_internal).lower())
gn_args += self.extra_gn_args_str
return ['gn', 'gen', self.output_directory, '--args=%s' % gn_args]
@@ -262,7 +269,7 @@ class _BuildHelper(object):
def Run(self):
"""Run GN gen/ninja build and return the process returncode."""
- logging.info('Building: %s.', self.target)
+ logging.info('Building: %s (this might take a while).', self.target)
retcode = _RunCmd(
self._GenGnCmd(), verbose=True, exit_on_failure=False)[1]
if retcode:
@@ -612,7 +619,7 @@ def _DownloadAndArchive(gsutil_path, archive, dl_dir, build, supersize_path):
_Die('unexpected error while downloading %s. It may no longer exist on '
'the server or it may not have been uploaded yet (check %s). '
'Otherwise, you may not have the correct access permissions.',
- build.DownloadUrl(archive.rev), _BUILDER_URL)
+ build.DownloadUrl(archive.rev), build.builder_url)
# Files needed for supersize and resource_sizes. Paths relative to out dir.
to_extract = [build.main_lib_path, build.map_file_path, 'args.gn']
@@ -675,7 +682,7 @@ def _SetRestoreFunc(subrepo):
def main():
parser = argparse.ArgumentParser(
- description='Find the cause of APK size bloat.')
+ description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('--archive-directory',
default=_DEFAULT_ARCHIVE_DIR,
help='Where results are stored.')
@@ -683,33 +690,35 @@ def main():
help='Find binary size bloat for this commit.')
parser.add_argument('--reference-rev',
help='Older rev to diff against. If not supplied, '
- 'the previous commit to rev will be used.')
+ 'the previous commit to rev will be used.')
parser.add_argument('--all',
action='store_true',
help='Build/download all revs from --reference-rev to '
- 'rev and diff the contiguous revisions.')
+ 'rev and diff the contiguous revisions.')
parser.add_argument('--include-slow-options',
action='store_true',
help='Run some extra steps that take longer to complete. '
- 'This includes apk-patch-size estimation and '
- 'static-initializer counting.')
+ 'This includes apk-patch-size estimation and '
+ 'static-initializer counting.')
parser.add_argument('--cloud',
action='store_true',
help='Download build artifacts from perf builders '
- '(Android only, Googlers only).')
+ '(Googlers only).')
parser.add_argument('--depot-tools-path',
help='Custom path to depot tools. Needed for --cloud if '
- 'depot tools isn\'t in your PATH.')
+ 'depot tools isn\'t in your PATH.')
parser.add_argument('--subrepo',
help='Specify a subrepo directory to use. Gclient sync '
- 'will be skipped if this option is used and all git '
- 'commands will be executed from the subrepo directory. '
- 'This option doesn\'t work with --cloud.')
- parser.add_argument('--silent',
+ 'will be skipped if this option is used and all git '
+ 'commands will be executed from the subrepo '
+ 'directory. This option doesn\'t work with --cloud.')
+ parser.add_argument('-v',
+ '--verbose',
action='store_true',
- help='Less logging, no Ninja/GN output.')
+ help='Show commands executed, extra debugging output'
+ ', and Ninja/GN output')
- build_group = parser.add_argument_group('ninja', 'Args to use with ninja/gn')
+ build_group = parser.add_argument_group('ninja arguments')
build_group.add_argument('-j',
dest='max_jobs',
help='Run N jobs in parallel.')
@@ -729,19 +738,19 @@ def main():
build_group.add_argument('--output-directory',
default=_DEFAULT_OUT_DIR,
help='ninja output directory. '
- 'Default: %s.' % _DEFAULT_OUT_DIR)
+ 'Default: %s.' % _DEFAULT_OUT_DIR)
build_group.add_argument('--enable-chrome-android-internal',
action='store_true',
help='Allow downstream targets to be built.')
build_group.add_argument('--target',
default=_DEFAULT_ANDROID_TARGET,
help='GN APK target to build. Ignored for Linux. '
- 'Default %s.' % _DEFAULT_ANDROID_TARGET)
+ 'Default %s.' % _DEFAULT_ANDROID_TARGET)
if len(sys.argv) == 1:
parser.print_help()
sys.exit()
args = parser.parse_args()
- log_level = logging.INFO if args.silent else logging.DEBUG
+ log_level = logging.DEBUG if args.verbose else logging.INFO
logging.basicConfig(level=log_level,
format='%(levelname).1s %(relativeCreated)6d %(message)s')
build = _BuildHelper(args)
@@ -752,7 +761,7 @@ def main():
_EnsureDirectoryClean(subrepo)
_SetRestoreFunc(subrepo)
if build.IsLinux():
- _VerifyUserAccepts('Linux diffs have known deficiencies (crbug/717550).')
+ _VerifyUserAccepts('Linux diffs have known deficiencies (crbug/717550). ')
rev, reference_rev = _ValidateRevs(
args.rev, args.reference_rev or args.rev + '^', subrepo)
« no previous file with comments | « tools/binary_size/README.md ('k') | tools/binary_size/libsupersize/describe.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698