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

Unified Diff: tools/binary_size/models.py

Issue 2801663003: //tools/binary_size: Add Disassemble() to console.py. Tweak metadata. (Closed)
Patch Set: Review comments 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
« no previous file with comments | « tools/binary_size/map2size.py ('k') | tools/binary_size/paths.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/binary_size/models.py
diff --git a/tools/binary_size/models.py b/tools/binary_size/models.py
index 11494faa8d4a4609f68a7ed45517394ae51ef1de..4461492fd74a92b3f1b191262080341ea3f4dc0d 100644
--- a/tools/binary_size/models.py
+++ b/tools/binary_size/models.py
@@ -1,7 +1,26 @@
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Classes that comprise the data model for binary size analysis."""
+"""Classes that comprise the data model for binary size analysis.
+
+The primary classes are Symbol, and SymbolGroup.
+
+Description of common properties:
+ * address: The start address of the symbol.
+ May be 0 (e.g. for .bss or for SymbolGroups).
+ * size: The number of bytes this symbol takes up, including padding that comes
+ before |address|.
+ * padding: The number of bytes of padding before |address| due to this symbol.
+ * name: Symbol names with parameter list removed.
+ Never None, but will be '' for anonymous symbols.
+ * full_name: Symbols names with parameter list left in.
+ Never None, but will be '' for anonymous symbols, and for symbols that do
+ not contain a parameter list.
+ * is_anonymous: True when the symbol exists in an anonymous namespace (which
+ are removed from both full_name and name during normalization).
+ * section_name: E.g. ".text", ".rodata", ".data.rel.local"
+ * section: The second character of |section_name|. E.g. "t", "r", "d".
+"""
import collections
import copy
@@ -11,6 +30,12 @@ import re
import match_util
+METADATA_GIT_REVISION = 'git_revision'
+METADATA_MAP_FILENAME = 'map_file_name'
+METADATA_ELF_FILENAME = 'elf_file_name'
+METADATA_ELF_MTIME = 'elf_mtime' # int timestamp in utc.
+METADATA_ELF_BUILD_ID = 'elf_build_id'
+
SECTION_TO_SECTION_NAME = {
'b': '.bss',
'd': '.data',
@@ -25,25 +50,26 @@ class SizeInfo(object):
Fields:
section_sizes: A dict of section_name -> size.
symbols: A SymbolGroup (or SymbolDiff) with all symbols in it.
+ metadata: A dict.
"""
__slots__ = (
'section_sizes',
'symbols',
- 'tag',
- 'timestamp',
+ 'metadata',
)
"""Root size information."""
- def __init__(self, section_sizes, symbols, timestamp=None, tag=''):
+ def __init__(self, section_sizes, symbols, metadata=None):
self.section_sizes = section_sizes # E.g. {'.text': 0}
self.symbols = symbols # List of symbols sorted by address per-section.
- self.timestamp = timestamp # UTC datetime object.
- self.tag = tag # E.g. git revision.
- assert not tag or '\n' not in tag # Simplifies file format.
+ self.metadata = metadata or {}
class BaseSymbol(object):
- """Base class for Symbol and SymbolGroup."""
+ """Base class for Symbol and SymbolGroup.
+
+ Refer to module docs for field descriptions.
+ """
__slots__ = ()
@property
@@ -83,7 +109,10 @@ class BaseSymbol(object):
class Symbol(BaseSymbol):
- """Represents a single symbol within a binary."""
+ """Represents a single symbol within a binary.
+
+ Refer to module docs for field descriptions.
+ """
__slots__ = (
'address',
« no previous file with comments | « tools/binary_size/map2size.py ('k') | tools/binary_size/paths.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698