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

Unified Diff: tools/binary_size/describe.py

Issue 2791433004: //tools/binary_size: source_path information, change file format, fixes (Closed)
Patch Set: fix comment for _DetectToolPrefix Created 3 years, 9 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/create_html_breakdown.py ('k') | tools/binary_size/file_format.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/binary_size/describe.py
diff --git a/tools/binary_size/describe.py b/tools/binary_size/describe.py
index f64992da1e1b877aa40e836daa7d5a36ce68478c..8e4a066173197f00c8ed7002c33369a06d38459e 100644
--- a/tools/binary_size/describe.py
+++ b/tools/binary_size/describe.py
@@ -3,7 +3,9 @@
# found in the LICENSE file.
"""Methods for converting model objects to human-readable formats."""
+import datetime
import itertools
+import time
import models
@@ -35,7 +37,8 @@ class Describer(object):
return
yield '{}@0x{:<8x} {:<7} {}'.format(
- sym.section, sym.address, sym.size, sym.path or '<no path>')
+ sym.section, sym.address, sym.size,
+ sym.source_path or sym.object_path or '{no path}')
if sym.name:
yield '{:22}{}'.format('', sym.name)
@@ -78,9 +81,10 @@ class Describer(object):
def GenerateLines(self, obj):
if isinstance(obj, models.SizeInfo):
+ metadata_desc = 'Metadata: %s' % DescribeSizeInfoMetadata(obj)
section_desc = self._DescribeSectionSizes(obj.section_sizes)
group_desc = self.GenerateLines(obj.symbols)
- return itertools.chain(section_desc, ('',), group_desc)
+ return itertools.chain((metadata_desc,), section_desc, ('',), group_desc)
if isinstance(obj, models.SymbolDiff):
return self._DescribeSymbolDiff(obj)
@@ -129,6 +133,20 @@ def DescribeSizeInfoCoverage(size_info):
yield '+ ' + one_stat(attributed_syms)
+def _UtcToLocal(utc):
+ epoch = time.mktime(utc.timetuple())
+ offset = (datetime.datetime.fromtimestamp(epoch) -
+ datetime.datetime.utcfromtimestamp(epoch))
+ return utc + offset
+
+
+def DescribeSizeInfoMetadata(size_info):
+ time_str = 'Unknown'
+ if size_info.timestamp:
+ time_str = _UtcToLocal(size_info.timestamp).strftime('%Y-%m-%d %H:%M:%S')
+ return 'time=%s tag=%s' % (time_str, size_info.tag)
+
+
def GenerateLines(obj, verbose=False):
return Describer(verbose).GenerateLines(obj)
« no previous file with comments | « tools/binary_size/create_html_breakdown.py ('k') | tools/binary_size/file_format.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698