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

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

Issue 2888693002: supersize: Add Print(idx). Sort subgroups in canned_queries. (Closed)
Patch Set: supersize: Add Print(idx). Sort subgroups in canned_queries. Created 3 years, 7 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
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 """Classes that comprise the data model for binary size analysis. 4 """Classes that comprise the data model for binary size analysis.
5 5
6 The primary classes are Symbol, and SymbolGroup. 6 The primary classes are Symbol, and SymbolGroup.
7 7
8 Description of common properties: 8 Description of common properties:
9 * address: The start address of the symbol. 9 * address: The start address of the symbol.
10 May be 0 (e.g. for .bss or for SymbolGroups). 10 May be 0 (e.g. for .bss or for SymbolGroups).
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 self._padding = sum(s.padding for s in self.IterUniqueSymbols()) 397 self._padding = sum(s.padding for s in self.IterUniqueSymbols())
398 return self._padding 398 return self._padding
399 399
400 @property 400 @property
401 def aliases(self): 401 def aliases(self):
402 return None 402 return None
403 403
404 def IsGroup(self): 404 def IsGroup(self):
405 return True 405 return True
406 406
407 def SetName(self, full_name, template_name=None, name=None):
408 self.full_name = full_name
409 self.template_name = full_name if template_name is None else template_name
410 self.name = full_name if name is None else name
411
407 def IterUniqueSymbols(self): 412 def IterUniqueSymbols(self):
408 """Yields all symbols, but only one from each alias group.""" 413 """Yields all symbols, but only one from each alias group."""
409 seen_aliases_lists = set() 414 seen_aliases_lists = set()
410 for s in self: 415 for s in self:
411 if not s.aliases: 416 if not s.aliases:
412 yield s 417 yield s
413 elif id(s.aliases) not in seen_aliases_lists: 418 elif id(s.aliases) not in seen_aliases_lists:
414 seen_aliases_lists.add(id(s.aliases)) 419 seen_aliases_lists.add(id(s.aliases))
415 yield s 420 yield s
416 421
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 846
842 847
843 def _ExtractSuffixAfterSeparator(string, separator, count): 848 def _ExtractSuffixAfterSeparator(string, separator, count):
844 prev_idx = len(string) + 1 849 prev_idx = len(string) + 1
845 for _ in xrange(count): 850 for _ in xrange(count):
846 idx = string.rfind(separator, 0, prev_idx - 1) 851 idx = string.rfind(separator, 0, prev_idx - 1)
847 if idx < 0: 852 if idx < 0:
848 break 853 break
849 prev_idx = idx 854 prev_idx = idx
850 return string[:prev_idx] 855 return string[:prev_idx]
OLDNEW
« no previous file with comments | « tools/binary_size/libsupersize/console.py ('k') | tools/binary_size/libsupersize/testdata/Console.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698