| OLD | NEW |
| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 if self.IsBss(): | 353 if self.IsBss(): |
| 354 self._size = sum(s.size for s in self) | 354 self._size = sum(s.size for s in self) |
| 355 else: | 355 else: |
| 356 self._size = sum(s.size for s in self.IterUniqueSymbols()) | 356 self._size = sum(s.size for s in self.IterUniqueSymbols()) |
| 357 return self._size | 357 return self._size |
| 358 | 358 |
| 359 @property | 359 @property |
| 360 def pss(self): | 360 def pss(self): |
| 361 if self._pss is None: | 361 if self._pss is None: |
| 362 if self.IsBss(): | 362 if self.IsBss(): |
| 363 self._pss = self.size | 363 self._pss = float(self.size) |
| 364 else: | 364 else: |
| 365 self._pss = sum(s.pss for s in self) | 365 self._pss = sum(s.pss for s in self) |
| 366 return self._pss | 366 return self._pss |
| 367 | 367 |
| 368 @property | 368 @property |
| 369 def padding(self): | 369 def padding(self): |
| 370 if self._padding is None: | 370 if self._padding is None: |
| 371 self._padding = sum(s.padding for s in self.IterUniqueSymbols()) | 371 self._padding = sum(s.padding for s in self.IterUniqueSymbols()) |
| 372 return self._padding | 372 return self._padding |
| 373 | 373 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 | 712 |
| 713 def _ExtractPrefixBeforeSeparator(string, separator, count=1): | 713 def _ExtractPrefixBeforeSeparator(string, separator, count=1): |
| 714 idx = -len(separator) | 714 idx = -len(separator) |
| 715 prev_idx = None | 715 prev_idx = None |
| 716 for _ in xrange(count): | 716 for _ in xrange(count): |
| 717 idx = string.find(separator, idx + len(separator)) | 717 idx = string.find(separator, idx + len(separator)) |
| 718 if idx < 0: | 718 if idx < 0: |
| 719 break | 719 break |
| 720 prev_idx = idx | 720 prev_idx = idx |
| 721 return string[:prev_idx] | 721 return string[:prev_idx] |
| OLD | NEW |