| 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 datetime | 6 import datetime |
| 7 import itertools | 7 import itertools |
| 8 import time | 8 import time |
| 9 | 9 |
| 10 import models | 10 import models |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 for l in self._DescribeSymbolGroupChildren(s, indent=indent + 1): | 119 for l in self._DescribeSymbolGroupChildren(s, indent=indent + 1): |
| 120 yield l | 120 yield l |
| 121 | 121 |
| 122 def _DescribeSymbolGroup(self, group): | 122 def _DescribeSymbolGroup(self, group): |
| 123 total_size = group.pss | 123 total_size = group.pss |
| 124 code_syms = group.WhereInSection('t') | 124 code_syms = group.WhereInSection('t') |
| 125 code_size = code_syms.pss | 125 code_size = code_syms.pss |
| 126 ro_size = code_syms.Inverted().WhereInSection('r').pss | 126 ro_size = code_syms.Inverted().WhereInSection('r').pss |
| 127 unique_paths = set(s.object_path for s in group) | 127 unique_paths = set(s.object_path for s in group) |
| 128 header_desc = [ | 128 header_desc = [ |
| 129 'Showing {:,} symbols with total pss: {} bytes'.format( | 129 'Showing {:,} symbols ({:,} unique) with total pss: {} bytes'.format( |
| 130 len(group), int(total_size)), | 130 len(group), group.CountUniqueSymbols(), int(total_size)), |
| 131 '.text={:<10} .rodata={:<10} other={:<10} total={}'.format( | 131 '.text={:<10} .rodata={:<10} other={:<10} total={}'.format( |
| 132 _PrettySize(int(code_size)), _PrettySize(int(ro_size)), | 132 _PrettySize(int(code_size)), _PrettySize(int(ro_size)), |
| 133 _PrettySize(int(total_size - code_size - ro_size)), | 133 _PrettySize(int(total_size - code_size - ro_size)), |
| 134 _PrettySize(int(total_size))), | 134 _PrettySize(int(total_size))), |
| 135 'Number of object files: {}'.format(len(unique_paths)), | 135 'Number of object files: {}'.format(len(unique_paths)), |
| 136 '', | 136 '', |
| 137 'First columns are: running total, address, pss', | 137 'First columns are: running total, address, pss', |
| 138 ] | 138 ] |
| 139 children_desc = self._DescribeSymbolGroupChildren(group) | 139 children_desc = self._DescribeSymbolGroupChildren(group) |
| 140 return itertools.chain(header_desc, children_desc) | 140 return itertools.chain(header_desc, children_desc) |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 291 |
| 292 def GenerateLines(obj, verbose=False, recursive=False): | 292 def GenerateLines(obj, verbose=False, recursive=False): |
| 293 """Returns an iterable of lines (without \n) that describes |obj|.""" | 293 """Returns an iterable of lines (without \n) that describes |obj|.""" |
| 294 return Describer(verbose=verbose, recursive=recursive).GenerateLines(obj) | 294 return Describer(verbose=verbose, recursive=recursive).GenerateLines(obj) |
| 295 | 295 |
| 296 | 296 |
| 297 def WriteLines(lines, func): | 297 def WriteLines(lines, func): |
| 298 for l in lines: | 298 for l in lines: |
| 299 func(l) | 299 func(l) |
| 300 func('\n') | 300 func('\n') |
| OLD | NEW |