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

Unified Diff: tools/binary_size/models.py

Issue 2802893002: Add gn args to metadata and metadata diffing (Closed)
Patch Set: 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/testdata/ActualDiff.golden » ('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 812fbd73c03c800e3fc31a12c4bbcf901e63c742..854c6d940f136df522ff5ab37b83442ed1be1594 100644
--- a/tools/binary_size/models.py
+++ b/tools/binary_size/models.py
@@ -33,10 +33,12 @@ import match_util
METADATA_GIT_REVISION = 'git_revision'
-METADATA_MAP_FILENAME = 'map_file_name'
-METADATA_ELF_FILENAME = 'elf_file_name'
+METADATA_MAP_FILENAME = 'map_file_name' # Path relative to output_directory.
+METADATA_ELF_FILENAME = 'elf_file_name' # Path relative to output_directory.
METADATA_ELF_MTIME = 'elf_mtime' # int timestamp in utc.
METADATA_ELF_BUILD_ID = 'elf_build_id'
+METADATA_GN_ARGS = 'gn_args'
+
SECTION_TO_SECTION_NAME = {
'b': '.bss',
@@ -51,7 +53,7 @@ class SizeInfo(object):
Fields:
section_sizes: A dict of section_name -> size.
- symbols: A SymbolGroup (or SymbolDiff) with all symbols in it.
+ symbols: A SymbolGroup with all symbols in it.
metadata: A dict.
"""
__slots__ = (
@@ -67,6 +69,29 @@ class SizeInfo(object):
self.metadata = metadata or {}
+class SizeInfoDiff(object):
+ """What you get when you Diff() two SizeInfo objects.
+
+ Fields:
+ section_sizes: A dict of section_name -> size delta.
+ symbols: A SymbolDiff with all symbols in it.
+ old_metadata: metadata of the "old" SizeInfo.
+ new_metadata: metadata of the "new" SizeInfo.
+ """
+ __slots__ = (
+ 'section_sizes',
+ 'symbols',
+ 'old_metadata',
+ 'new_metadata',
+ )
+
+ def __init__(self, section_sizes, symbols, old_metadata, new_metadata):
+ self.section_sizes = section_sizes
+ self.symbols = symbols
+ self.old_metadata = old_metadata
+ self.new_metadata = new_metadata
+
+
class BaseSymbol(object):
"""Base class for Symbol and SymbolGroup.
@@ -549,9 +574,7 @@ class SymbolDiff(SymbolGroup):
def Diff(new, old):
"""Diffs two SizeInfo or SymbolGroup objects.
- When diffing SizeInfos, ret.section_sizes are the result of |new| - |old|, and
- ret.symbols will be a SymbolDiff.
-
+ When diffing SizeInfos, a SizeInfoDiff is returned.
When diffing SymbolGroups, a SymbolDiff is returned.
Returns:
@@ -563,7 +586,7 @@ def Diff(new, old):
section_sizes = {
k:new.section_sizes[k] - v for k, v in old.section_sizes.iteritems()}
symbol_diff = Diff(new.symbols, old.symbols)
- return SizeInfo(section_sizes, symbol_diff)
+ return SizeInfoDiff(section_sizes, symbol_diff, old.metadata, new.metadata)
assert isinstance(new, SymbolGroup) and isinstance(old, SymbolGroup)
symbols_by_key = collections.defaultdict(list)
« no previous file with comments | « tools/binary_size/map2size.py ('k') | tools/binary_size/testdata/ActualDiff.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698