| 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 """Methods for converting model objects to human-readable formats.""" | 4 """Methods for converting model objects to human-readable formats.""" |
| 5 | 5 |
| 6 import itertools | 6 import itertools |
| 7 | 7 |
| 8 import models | 8 import models |
| 9 | 9 |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 yield '{}: {:,} bytes ({:.1%})'.format(name, size, percent) | 28 yield '{}: {:,} bytes ({:.1%})'.format(name, size, percent) |
| 29 | 29 |
| 30 def _DescribeSymbol(self, sym): | 30 def _DescribeSymbol(self, sym): |
| 31 # SymbolGroups are passed here when we don't want to expand them. | 31 # SymbolGroups are passed here when we don't want to expand them. |
| 32 if sym.IsGroup(): | 32 if sym.IsGroup(): |
| 33 yield '{} {:<8} {} (count={})'.format(sym.section, sym.size, sym.name, | 33 yield '{} {:<8} {} (count={})'.format(sym.section, sym.size, sym.name, |
| 34 len(sym)) | 34 len(sym)) |
| 35 return | 35 return |
| 36 | 36 |
| 37 yield '{}@0x{:<8x} {:<7} {}'.format( | 37 yield '{}@0x{:<8x} {:<7} {}'.format( |
| 38 sym.section, sym.address, sym.size, sym.path or '<no path>') | 38 sym.section, sym.address, sym.size, |
| 39 sym.source_path or sym.object_path or '{no path}') |
| 39 if sym.name: | 40 if sym.name: |
| 40 yield '{:22}{}'.format('', sym.name) | 41 yield '{:22}{}'.format('', sym.name) |
| 41 | 42 |
| 42 def _DescribeSymbolGroup(self, group, prefix_func=None): | 43 def _DescribeSymbolGroup(self, group, prefix_func=None): |
| 43 yield 'Showing {:,} symbols with total size: {:} bytes'.format( | 44 yield 'Showing {:,} symbols with total size: {:} bytes'.format( |
| 44 len(group), group.size) | 45 len(group), group.size) |
| 45 yield 'First columns are: running total, type, size' | 46 yield 'First columns are: running total, type, size' |
| 46 | 47 |
| 47 running_total = 0 | 48 running_total = 0 |
| 48 prefix = '' | 49 prefix = '' |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 131 |
| 131 | 132 |
| 132 def GenerateLines(obj, verbose=False): | 133 def GenerateLines(obj, verbose=False): |
| 133 return Describer(verbose).GenerateLines(obj) | 134 return Describer(verbose).GenerateLines(obj) |
| 134 | 135 |
| 135 | 136 |
| 136 def WriteLines(lines, func): | 137 def WriteLines(lines, func): |
| 137 for l in lines: | 138 for l in lines: |
| 138 func(l) | 139 func(l) |
| 139 func('\n') | 140 func('\n') |
| OLD | NEW |