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

Unified Diff: build/scripts/slave/chromium/sizes.py

Issue 9323047: Update sizes.py to print a list of all static initializers (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/
Patch Set: '' Created 8 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/scripts/slave/chromium/sizes.py
===================================================================
--- build/scripts/slave/chromium/sizes.py (revision 120366)
+++ build/scripts/slave/chromium/sizes.py (working copy)
@@ -165,30 +165,22 @@
(binary_name + '-bss', 'bss', '', bss, 'bytes'),
]
- # Find the number of files with at least one static initializer.
- # First determine if we're 32 or 64 bit
- result, stdout = run_process(result, ['readelf', '-h', binary_file])
- elf_class_line = re.search('Class:.*$', stdout, re.MULTILINE).group(0)
- elf_class = re.split('\W+', elf_class_line)[1]
- if elf_class == 'ELF32':
- word_size = 4
- else:
- word_size = 8
+ # For Release builds only, use dump-static-initializers.py to get the number
+ # of static initializers.
+ if 'Release' in target_dir:
Lei Zhang 2012/02/03 22:54:57 Otherwise, maybe os.path.basename(target_dir) is m
Tyler Breisacher (Chromium) 2012/02/04 03:03:19 You're right, that's probably cleaner.
+ dump_static_initializers = os.path.join(os.path.dirname(target_dir),
Lei Zhang 2012/02/03 22:54:57 If |target_dir| is /path/to/src/out/Release, don't
Tyler Breisacher (Chromium) 2012/02/04 03:03:19 I think you're right.
+ '..', 'tools', 'linux',
+ 'dump-static-initializers.py')
+ result, stdout = run_process(result, [dump_static_initializers,
+ '-d', binary_file])
+ count = re.search('Found (\d+) static initializers',
+ stdout).group(1)
+ if count is not '0':
+ print '\nStatic initializers in %s:' % binary_file
+ print stdout
+ sizes.append(
+ (binary_name + '-si', 'initializers', '', count, 'initializers'))
- # Then find the size of the .ctors section.
- result, stdout = run_process(result, ['readelf', '-SW', binary_file])
- size_match = re.search('.ctors.*$', stdout, re.MULTILINE)
- if size_match is None:
- count = 0
- else:
- size_line = re.search('.ctors.*$', stdout, re.MULTILINE).group(0)
- size = re.split('\W+', size_line)[5]
- size = int(size, 16)
- # The first entry is always 0 and the last is -1 as guards.
- # So subtract 2 from the count.
- count = (size / word_size) - 2
- sizes.append((binary_name + '-si', 'initializers', '', count, 'files'))
-
# Determine if the binary has the DT_TEXTREL marker.
result, stdout = run_process(result, ['readelf', '-Wd', binary_file])
if re.search(r'\bTEXTREL\b', stdout) is None:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698