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

Unified Diff: tools/binary_size/helpers.py

Issue 2813963002: //tools/binary_size: Consolidate most tools into "supersize" command (Closed)
Patch Set: Fix readme formatting. Make archive's --outoput-file a positional arg Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/binary_size/function_signature_test.py ('k') | tools/binary_size/integration_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/binary_size/helpers.py
diff --git a/tools/binary_size/helpers.py b/tools/binary_size/helpers.py
deleted file mode 100644
index c82a6ba161947969f8ad128038b34271803fbfc5..0000000000000000000000000000000000000000
--- a/tools/binary_size/helpers.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Utility methods."""
-
-import atexit
-import distutils.spawn
-import logging
-import os
-import platform
-import resource
-import sys
-
-
-SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
-
-
-def AddCommonOptionsAndParseArgs(parser, argv, pypy_warn=True):
- parser.add_argument('--no-pypy', action='store_true',
- help='Do not automatically switch to pypy when available')
- parser.add_argument('-v',
- '--verbose',
- default=0,
- action='count',
- help='Verbose level (multiple times for more)')
- args = parser.parse_args(argv[1:])
-
- logging.basicConfig(level=logging.WARNING - args.verbose * 10,
- format='%(levelname).1s %(relativeCreated)6d %(message)s')
-
- if not args.no_pypy and platform.python_implementation() == 'CPython':
- # Switch to pypy if it's available.
- pypy_path = distutils.spawn.find_executable('pypy')
- if pypy_path:
- logging.debug('Switching to pypy.')
- os.execv(pypy_path, [pypy_path] + sys.argv)
- # NOTE! Running with python: 6s. Running with pypy: 3s
- if pypy_warn:
- logging.warning(
- 'This script runs more than 2x faster if you install pypy.')
-
- if logging.getLogger().isEnabledFor(logging.DEBUG):
- atexit.register(_LogPeakRamUsage)
- return args
-
-
-def _LogPeakRamUsage():
- peak_ram_usage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
- peak_ram_usage += resource.getrusage(resource.RUSAGE_CHILDREN).ru_maxrss
- logging.info('Peak RAM usage was %d MB.', peak_ram_usage / 1024)
« no previous file with comments | « tools/binary_size/function_signature_test.py ('k') | tools/binary_size/integration_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698