| Index: tools/binary_size/libsupersize/describe.py
|
| diff --git a/tools/binary_size/libsupersize/describe.py b/tools/binary_size/libsupersize/describe.py
|
| index 876f1e15f04dc83309dadef77af03bf91532dc15..363ff66a1131c20b11bc93de1ddd7009c0a117d2 100644
|
| --- a/tools/binary_size/libsupersize/describe.py
|
| +++ b/tools/binary_size/libsupersize/describe.py
|
| @@ -68,7 +68,7 @@ class Describer(object):
|
| for name in section_names:
|
| yield ' {}: {:,} bytes'.format(name, section_sizes[name])
|
|
|
| - def _DescribeSymbol(self, sym):
|
| + def _DescribeSymbol(self, sym, single_line=False):
|
| if sym.IsGroup():
|
| address = 'Group'
|
| else:
|
| @@ -83,10 +83,14 @@ class Describer(object):
|
| if sym.name:
|
| yield ' flags={} name={}'.format(sym.FlagsString(), sym.name)
|
| if sym.full_name:
|
| - yield ' full_name={}'.format(sym.full_name)
|
| + yield ' full_name={}'.format(sym.full_name)
|
| elif sym.full_name:
|
| yield ' flags={} full_name={}'.format(
|
| sym.FlagsString(), sym.full_name)
|
| + elif single_line:
|
| + count_part = ' (count=%d)' % len(sym) if sym.IsGroup() else ''
|
| + yield '{}@{:<9s} {:<7} {}{}'.format(
|
| + sym.section, address, int(sym.pss), sym.name, count_part)
|
| else:
|
| yield '{}@{:<9s} {:<7} {}'.format(
|
| sym.section, address, int(sym.pss),
|
| @@ -97,23 +101,27 @@ class Describer(object):
|
|
|
| def _DescribeSymbolGroupChildren(self, group, indent=0):
|
| running_total = 0
|
| - sorted_syms = group if group.is_sorted else group.Sorted()
|
| + running_percent = 0
|
| is_diff = isinstance(group, models.SymbolDiff)
|
| + all_groups = all(s.IsGroup() for s in group)
|
|
|
| indent_prefix = '> ' * indent
|
| diff_prefix = ''
|
| - for s in sorted_syms:
|
| + total = group.pss
|
| + for index, s in enumerate(group):
|
| if group.IsBss() or not s.IsBss():
|
| running_total += s.pss
|
| - for l in self._DescribeSymbol(s):
|
| + running_percent = running_total / total
|
| + for l in self._DescribeSymbol(s, single_line=all_groups):
|
| if l[:4].isspace():
|
| indent_size = 8 + len(indent_prefix) + len(diff_prefix)
|
| yield '{} {}'.format(' ' * indent_size, l)
|
| else:
|
| if is_diff:
|
| diff_prefix = _DiffPrefix(group, s)
|
| - yield '{}{}{:8} {}'.format(indent_prefix, diff_prefix,
|
| - int(running_total), l)
|
| + yield '{}{}{:<4} {:8} {:7} {}'.format(
|
| + indent_prefix, diff_prefix, str(index) + ')', int(running_total),
|
| + '({:.1%})'.format(running_percent), l)
|
|
|
| if self.recursive and s.IsGroup():
|
| for l in self._DescribeSymbolGroupChildren(s, indent=indent + 1):
|
| @@ -134,7 +142,8 @@ class Describer(object):
|
| _PrettySize(int(total_size))),
|
| 'Number of object files: {}'.format(len(unique_paths)),
|
| '',
|
| - 'First columns are: running total, address, pss',
|
| + 'Index, Running Total, Section@Address, PSS',
|
| + '-' * 60
|
| ]
|
| children_desc = self._DescribeSymbolGroupChildren(group)
|
| return itertools.chain(header_desc, children_desc)
|
|
|