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

Unified Diff: tools/binary_size/libsupersize/describe.py

Issue 2858793002: Create a star symbol for gaps at the start & end of sections (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: tools/binary_size/libsupersize/describe.py
diff --git a/tools/binary_size/libsupersize/describe.py b/tools/binary_size/libsupersize/describe.py
index 30a1db86c5357875b1d1953491c82f96a635724c..38d99a53919a6210e2ce1887946b109403772f81 100644
--- a/tools/binary_size/libsupersize/describe.py
+++ b/tools/binary_size/libsupersize/describe.py
@@ -228,26 +228,37 @@ def DescribeSizeInfoCoverage(size_info):
expected_size = size_info.section_sizes[
models.SECTION_TO_SECTION_NAME[section]]
- def one_stat(group):
- template = ('Section {}: has {:.1%} of {} bytes accounted for from '
- '{} symbols. {} bytes are unaccounted for.')
- actual_size = group.size
- size_percent = float(actual_size) / expected_size
- return template.format(section, size_percent, actual_size, len(group),
- expected_size - actual_size)
in_section = size_info.symbols.WhereInSection(section)
- yield one_stat(in_section)
+ actual_size = in_section.size
+ size_percent = float(actual_size) / expected_size
+ yield ('Section {}: has {:.1%} of {} bytes accounted for from '
+ '{} symbols. {} bytes are unaccounted for.').format(
+ section, size_percent, actual_size, len(in_section),
+ expected_size - actual_size)
+ star_syms = in_section.WhereNameMatches(r'^\*')
+ padding = in_section.padding - star_syms.padding
+ anonymous_syms = star_syms.Inverted().WhereHasAnyAttribution().Inverted()
yield '* Padding accounts for {} bytes ({:.1%})'.format(
- in_section.padding, float(in_section.padding) / in_section.size)
+ padding, float(padding) / in_section.size)
+ if len(star_syms):
+ yield ('* {} placeholders (symbols that start with **) account for '
+ '{} bytes ({:.1%})').format(
+ len(star_syms), star_syms.pss, star_syms.pss / in_section.size)
+ if anonymous_syms:
+ yield '* {} anonymous symbols account for {} bytes ({:.1%})'.format(
+ len(anonymous_syms), int(anonymous_syms.pss),
+ star_syms.pss / in_section.size)
aliased_symbols = in_section.Filter(lambda s: s.aliases)
- if len(aliased_symbols):
- uniques = sum(1 for s in aliased_symbols.IterUniqueSymbols())
- yield '* Contains {} aliases, mapped to {} addresses ({} bytes)'.format(
- len(aliased_symbols), uniques, aliased_symbols.size)
- else:
- yield '* Contains 0 aliases'
+ if section == 't':
+ if len(aliased_symbols):
+ uniques = sum(1 for s in aliased_symbols.IterUniqueSymbols())
+ yield ('* Contains {} aliases, mapped to {} unique addresses '
+ '({} bytes)').format(
+ len(aliased_symbols), uniques, aliased_symbols.size)
+ else:
+ yield '* Contains 0 aliases'
inlined_symbols = in_section.WhereObjectPathMatches('{shared}')
if len(inlined_symbols):
@@ -256,17 +267,6 @@ def DescribeSizeInfoCoverage(size_info):
else:
yield '* 0 symbols have shared ownership'
- star_syms = in_section.WhereNameMatches(r'^\*')
- attributed_syms = star_syms.Inverted().WhereHasAnyAttribution()
- anonymous_syms = attributed_syms.Inverted()
- if star_syms or anonymous_syms:
- missing_size = star_syms.pss + anonymous_syms.pss
- anon_str = ''
- if len(anonymous_syms):
- anon_str = 'and {} anonymous entries '.format(len(anonymous_syms))
- yield '* Without {} merge sections {}(accounting for {} bytes):'.format(
- len(star_syms), anon_str, int(missing_size))
- yield ' * ' + one_stat(attributed_syms)
def _UtcToLocal(utc):
« no previous file with comments | « tools/binary_size/libsupersize/cluster_symbols.py ('k') | tools/binary_size/libsupersize/linker_map_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698