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

Side by Side Diff: tools/binary_size/libsupersize/diff.py

Issue 2924343004: supersize: Fix path counts, missing section in clusters (Closed)
Patch Set: add comments Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « tools/binary_size/libsupersize/describe.py ('k') | tools/binary_size/libsupersize/models.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 """Logic for diffing two SizeInfo objects.""" 4 """Logic for diffing two SizeInfo objects."""
5 5
6 import collections 6 import collections
7 import re 7 import re
8 8
9 import models 9 import models
10 10
(...skipping 14 matching lines...) Expand all
25 ".L__unnamed_1193", ".L__unnamed_712" 25 ".L__unnamed_1193", ".L__unnamed_712"
26 """ 26 """
27 name = symbol.full_name 27 name = symbol.full_name
28 clone_idx = name.find(' [clone ') 28 clone_idx = name.find(' [clone ')
29 if clone_idx != -1: 29 if clone_idx != -1:
30 name = name[:clone_idx] 30 name = name[:clone_idx]
31 if name.startswith('*'): 31 if name.startswith('*'):
32 # "symbol gap 3 (bar)" -> "symbol gaps" 32 # "symbol gap 3 (bar)" -> "symbol gaps"
33 name = re.sub(r'\s+\d+( \(.*\))?$', 's', name) 33 name = re.sub(r'\s+\d+( \(.*\))?$', 's', name)
34 34
35 # Use section rather than section_name since clang & gcc use
36 # .data.rel.ro vs .data.rel.ro.local.
35 if '.' not in name: 37 if '.' not in name:
36 return (symbol.section_name, name) 38 return (symbol.section, name)
39
37 # Compiler or Linker generated symbol. 40 # Compiler or Linker generated symbol.
38 name = re.sub(r'[.0-9]', '', name) # Strip out all numbers and dots. 41 name = re.sub(r'[.0-9]', '', name) # Strip out all numbers and dots.
39 return (symbol.section_name, name, symbol.object_path) 42 return (symbol.section, name, symbol.object_path)
40 43
41 44
42 def _CloneSymbol(sym, size): 45 def _CloneSymbol(sym, size):
43 """Returns a copy of |sym| with an updated |size|. 46 """Returns a copy of |sym| with an updated |size|.
44 47
45 Padding and aliases are not copied. 48 Padding and aliases are not copied.
46 """ 49 """
47 return models.Symbol( 50 return models.Symbol(
48 sym.section_name, size, address=sym.address, full_name=sym.full_name, 51 sym.section_name, size, address=sym.address, full_name=sym.full_name,
49 template_name=sym.template_name, name=sym.name, 52 template_name=sym.template_name, name=sym.name,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 assert isinstance(after, models.SizeInfo) 187 assert isinstance(after, models.SizeInfo)
185 section_sizes = {k: after.section_sizes.get(k, 0) - v 188 section_sizes = {k: after.section_sizes.get(k, 0) - v
186 for k, v in before.section_sizes.iteritems()} 189 for k, v in before.section_sizes.iteritems()}
187 for k, v in after.section_sizes.iteritems(): 190 for k, v in after.section_sizes.iteritems():
188 if k not in section_sizes: 191 if k not in section_sizes:
189 section_sizes[k] = v 192 section_sizes[k] = v
190 193
191 symbol_diff = _DiffSymbolGroups(before.raw_symbols, after.raw_symbols) 194 symbol_diff = _DiffSymbolGroups(before.raw_symbols, after.raw_symbols)
192 return models.SizeInfoDiff(section_sizes, symbol_diff, before.metadata, 195 return models.SizeInfoDiff(section_sizes, symbol_diff, before.metadata,
193 after.metadata) 196 after.metadata)
OLDNEW
« no previous file with comments | « tools/binary_size/libsupersize/describe.py ('k') | tools/binary_size/libsupersize/models.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698