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

Side by Side Diff: tools/binary_size/libsupersize/html_report.py

Issue 2870743003: supersize: Add symbol.template_name, and strip <>s from symbol.name (Closed)
Patch Set: review comments 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Creates an html report that allows you to view binary size by component.""" 5 """Creates an html report that allows you to view binary size by component."""
6 6
7 import argparse 7 import argparse
8 import json 8 import json
9 import logging 9 import logging
10 import os 10 import os
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 if not path_part: 127 if not path_part:
128 continue 128 continue
129 depth += 1 129 depth += 1
130 node = _GetOrMakeChildNode(node, _NODE_TYPE_PATH, path_part) 130 node = _GetOrMakeChildNode(node, _NODE_TYPE_PATH, path_part)
131 131
132 symbol_type = symbol.section 132 symbol_type = symbol.section
133 if symbol.name.endswith('[vtable]'): 133 if symbol.name.endswith('[vtable]'):
134 symbol_type = _NODE_SYMBOL_TYPE_VTABLE 134 symbol_type = _NODE_SYMBOL_TYPE_VTABLE
135 elif symbol.name.endswith(']'): 135 elif symbol.name.endswith(']'):
136 symbol_type = _NODE_SYMBOL_TYPE_GENERATED 136 symbol_type = _NODE_SYMBOL_TYPE_GENERATED
137 _AddSymbolIntoFileNode(node, symbol_type, symbol.name, symbol.pss, 137 _AddSymbolIntoFileNode(node, symbol_type, symbol.template_name, symbol.pss,
138 include_symbols) 138 include_symbols)
139 depth += 2 139 depth += 2
140 result[_NODE_MAX_DEPTH_KEY] = max(result[_NODE_MAX_DEPTH_KEY], depth) 140 result[_NODE_MAX_DEPTH_KEY] = max(result[_NODE_MAX_DEPTH_KEY], depth)
141 141
142 # The (no path) bucket can be extremely large if we failed to get 142 # The (no path) bucket can be extremely large if we failed to get
143 # path information. Split it into subgroups if needed. 143 # path information. Split it into subgroups if needed.
144 no_path_bucket = result[_NODE_CHILDREN_KEY].get(_NAME_NO_PATH_BUCKET) 144 no_path_bucket = result[_NODE_CHILDREN_KEY].get(_NAME_NO_PATH_BUCKET)
145 if no_path_bucket and include_symbols: 145 if no_path_bucket and include_symbols:
146 _SplitLargeBucket(no_path_bucket) 146 _SplitLargeBucket(no_path_bucket)
147 147
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 tree_root = _MakeCompactTree(symbols, args.include_symbols) 195 tree_root = _MakeCompactTree(symbols, args.include_symbols)
196 196
197 logging.info('Serializing JSON') 197 logging.info('Serializing JSON')
198 with open(os.path.join(args.report_dir, 'data.js'), 'w') as out_file: 198 with open(os.path.join(args.report_dir, 'data.js'), 'w') as out_file:
199 out_file.write('var tree_data=') 199 out_file.write('var tree_data=')
200 # Use separators without whitespace to get a smaller file. 200 # Use separators without whitespace to get a smaller file.
201 json.dump(tree_root, out_file, ensure_ascii=False, check_circular=False, 201 json.dump(tree_root, out_file, ensure_ascii=False, check_circular=False,
202 separators=(',', ':')) 202 separators=(',', ':'))
203 203
204 logging.warning('Report saved to %s/index.html', args.report_dir) 204 logging.warning('Report saved to %s/index.html', args.report_dir)
OLDNEW
« no previous file with comments | « tools/binary_size/libsupersize/function_signature_test.py ('k') | tools/binary_size/libsupersize/integration_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698