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

Unified Diff: tools/binary_size/libsupersize/html_report.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/libsupersize/helpers.py ('k') | tools/binary_size/libsupersize/integration_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/binary_size/libsupersize/html_report.py
diff --git a/tools/binary_size/create_html_breakdown.py b/tools/binary_size/libsupersize/html_report.py
old mode 100755
new mode 100644
similarity index 95%
rename from tools/binary_size/create_html_breakdown.py
rename to tools/binary_size/libsupersize/html_report.py
index ad278b279a9778f53e6a09799f424d936acfb32f..ac21349848ba87b3f3336ea32042893cb250ce2d
--- a/tools/binary_size/create_html_breakdown.py
+++ b/tools/binary_size/libsupersize/html_report.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
# Copyright 2014 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.
@@ -12,8 +11,8 @@ import os
import shutil
import sys
+import archive
import helpers
-import map2size
# Node dictionary keys. These are output in json read by the webapp so
@@ -163,8 +162,7 @@ def _CopyTemplateFiles(dest_dir):
shutil.copy(os.path.join(template_src, 'D3SymbolTreeMap.js'), dest_dir)
-def main(argv):
- parser = argparse.ArgumentParser()
+def AddArguments(parser):
parser.add_argument('input_file',
help='Path to input .size file.')
parser.add_argument('--report-dir', metavar='PATH', required=True,
@@ -175,9 +173,14 @@ def main(argv):
'space)')
parser.add_argument('--include-symbols', action='store_true',
help='Use per-symbol granularity rather than per-file.')
- args = helpers.AddCommonOptionsAndParseArgs(parser, argv)
- size_info = map2size.LoadAndPostProcessSizeInfo(args.input_file)
+
+def Run(args, parser):
+ if not args.input_file.endswith('.size'):
+ parser.error('Input must end with ".size"')
+
+ logging.info('Reading .size file')
+ size_info = archive.LoadAndPostProcessSizeInfo(args.input_file)
symbols = size_info.symbols
if not args.include_bss:
symbols = symbols.WhereInSection('b').Inverted()
@@ -191,15 +194,11 @@ def main(argv):
logging.info('Creating JSON objects')
tree_root = _MakeCompactTree(symbols, args.include_symbols)
- logging.info('Serializing')
+ logging.info('Serializing JSON')
with open(os.path.join(args.report_dir, 'data.js'), 'w') as out_file:
out_file.write('var tree_data=')
# Use separators without whitespace to get a smaller file.
json.dump(tree_root, out_file, ensure_ascii=False, check_circular=False,
separators=(',', ':'))
- print 'Report saved to ' + args.report_dir + '/index.html'
-
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv))
+ logging.warning('Report saved to %s/index.html', args.report_dir)
« no previous file with comments | « tools/binary_size/libsupersize/helpers.py ('k') | tools/binary_size/libsupersize/integration_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698