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

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

Issue 2880003002: supersize: A few fixes for Android+clang builds (Closed)
Patch Set: rebase 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 self.template_name = template_name or '' 223 self.template_name = template_name or ''
224 self.name = name or '' 224 self.name = name or ''
225 self.source_path = source_path or '' 225 self.source_path = source_path or ''
226 self.object_path = object_path or '' 226 self.object_path = object_path or ''
227 self.size = size_without_padding 227 self.size = size_without_padding
228 self.flags = flags 228 self.flags = flags
229 self.aliases = aliases 229 self.aliases = aliases
230 self.padding = 0 230 self.padding = 0
231 231
232 def __repr__(self): 232 def __repr__(self):
233 template = ('{}@{:x}(size_without_padding={},padding={},name={},' 233 template = ('{}@{:x}(size_without_padding={},padding={},full_name={},'
234 'object_path={},source_path={},flags={})') 234 'object_path={},source_path={},flags={})')
235 return template.format( 235 return template.format(
236 self.section_name, self.address, self.size_without_padding, 236 self.section_name, self.address, self.size_without_padding,
237 self.padding, self.name, self.object_path, self.source_path, 237 self.padding, self.full_name, self.object_path, self.source_path,
238 self.FlagsString()) 238 self.FlagsString())
239 239
240 @property 240 @property
241 def pss(self): 241 def pss(self):
242 return float(self.size) / self.num_aliases 242 return float(self.size) / self.num_aliases
243 243
244 @property 244 @property
245 def pss_without_padding(self): 245 def pss_without_padding(self):
246 return float(self.size_without_padding) / self.num_aliases 246 return float(self.size_without_padding) / self.num_aliases
247 247
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 self._pss = None 282 self._pss = None
283 self._symbols = symbols 283 self._symbols = symbols
284 self._filtered_symbols = filtered_symbols or [] 284 self._filtered_symbols = filtered_symbols or []
285 self.full_name = full_name if full_name is not None else name 285 self.full_name = full_name if full_name is not None else name
286 self.template_name = template_name if template_name is not None else name 286 self.template_name = template_name if template_name is not None else name
287 self.name = name or '' 287 self.name = name or ''
288 self.section_name = section_name or '.*' 288 self.section_name = section_name or '.*'
289 self.is_sorted = is_sorted 289 self.is_sorted = is_sorted
290 290
291 def __repr__(self): 291 def __repr__(self):
292 return 'Group(name=%s,count=%d,size=%d)' % ( 292 return 'Group(full_name=%s,count=%d,size=%d)' % (
293 self.name, len(self), self.size) 293 self.full_name, len(self), self.size)
294 294
295 def __iter__(self): 295 def __iter__(self):
296 return iter(self._symbols) 296 return iter(self._symbols)
297 297
298 def __len__(self): 298 def __len__(self):
299 return len(self._symbols) 299 return len(self._symbols)
300 300
301 def __eq__(self, other): 301 def __eq__(self, other):
302 return self._symbols == other._symbols 302 return self._symbols == other._symbols
303 303
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 749
750 750
751 def _ExtractSuffixAfterSeparator(string, separator, count): 751 def _ExtractSuffixAfterSeparator(string, separator, count):
752 prev_idx = len(string) + 1 752 prev_idx = len(string) + 1
753 for _ in xrange(count): 753 for _ in xrange(count):
754 idx = string.rfind(separator, 0, prev_idx - 1) 754 idx = string.rfind(separator, 0, prev_idx - 1)
755 if idx < 0: 755 if idx < 0:
756 break 756 break
757 prev_idx = idx 757 prev_idx = idx
758 return string[:prev_idx] 758 return string[:prev_idx]
OLDNEW
« no previous file with comments | « tools/binary_size/libsupersize/linker_map_parser.py ('k') | tools/binary_size/libsupersize/nm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698