| OLD | NEW |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 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 """An interactive console for looking analyzing .size files.""" | 5 """An interactive console for looking analyzing .size files.""" |
| 6 | 6 |
| 7 import argparse | 7 import argparse |
| 8 import atexit | 8 import atexit |
| 9 import code | 9 import code |
| 10 import contextlib | 10 import contextlib |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 '', | 147 '', |
| 148 '# Show all attributes of all symbols & per-section totals:', | 148 '# Show all attributes of all symbols & per-section totals:', |
| 149 'Print(size_info, verbose=True)', | 149 'Print(size_info, verbose=True)', |
| 150 '', | 150 '', |
| 151 '# Show two levels of .text, grouped by first two subdirectories', | 151 '# Show two levels of .text, grouped by first two subdirectories', |
| 152 'text_syms = size_info.symbols.WhereInSection("t")', | 152 'text_syms = size_info.symbols.WhereInSection("t")', |
| 153 'by_path = text_syms.GroupBySourcePath(depth=2)', | 153 'by_path = text_syms.GroupBySourcePath(depth=2)', |
| 154 'Print(by_path.WhereBiggerThan(1024))', | 154 'Print(by_path.WhereBiggerThan(1024))', |
| 155 '', | 155 '', |
| 156 '# Show all non-vtable generated symbols', | 156 '# Show all non-vtable generated symbols', |
| 157 'generated_syms = size_info.symbols.WhereIsGenerated()', | 157 'generated_syms = size_info.symbols.WhereGeneratedByToolchain()', |
| 158 'Print(generated_syms.WhereNameMatches(r"vtable").Inverted())', | 158 'Print(generated_syms.WhereNameMatches(r"vtable").Inverted().Sorted())', |
| 159 '', | 159 '', |
| 160 '# Show all symbols that have "print" in their name or path, except', | 160 '# Show all symbols that have "print" in their name or path, except', |
| 161 '# those within components/.', | 161 '# those within components/.', |
| 162 '# Note: Could have also used Inverted(), as above.', | 162 '# Note: Could have also used Inverted(), as above.', |
| 163 '# Note: Use "help(ExpandRegex)" for more about what {{_print_}} does.', | 163 '# Note: Use "help(ExpandRegex)" for more about what {{_print_}} does.', |
| 164 'print_syms = size_info.symbols.WhereMatches(r"{{_print_}}")', | 164 'print_syms = size_info.symbols.WhereMatches(r"{{_print_}}")', |
| 165 'Print(print_syms - print_syms.WherePathMatches(r"^components/"))', | 165 'Print(print_syms - print_syms.WherePathMatches(r"^components/"))', |
| 166 '', | 166 '', |
| 167 '# Diff two .size files and save result to a file:', | 167 '# Diff two .size files and save result to a file:', |
| 168 'Print(Diff(size_info1, size_info2), to_file="output.txt")', | 168 'Print(Diff(size_info1, size_info2), to_file="output.txt")', |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 output_directory=args.output_directory, | 241 output_directory=args.output_directory, |
| 242 any_path_within_output_directory=args.inputs[0]) | 242 any_path_within_output_directory=args.inputs[0]) |
| 243 session = _Session(size_infos, lazy_paths) | 243 session = _Session(size_infos, lazy_paths) |
| 244 | 244 |
| 245 if args.query: | 245 if args.query: |
| 246 logging.info('Running query from command-line.') | 246 logging.info('Running query from command-line.') |
| 247 session.Eval(args.query) | 247 session.Eval(args.query) |
| 248 else: | 248 else: |
| 249 logging.info('Entering interactive console.') | 249 logging.info('Entering interactive console.') |
| 250 session.GoInteractive() | 250 session.GoInteractive() |
| OLD | NEW |