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

Side by Side Diff: tools/binary_size/README.md

Issue 2724253002: V1 of //tools/binary_size rewrite (Closed)
Patch Set: README tweaks, more cases for function parsing 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 unified diff | Download patch
OLDNEW
1 # run_binary_size_analysis.py 1 # analyze.py
2 2
3 ## About: 3 Parses and processes a linker .map file and outputs the result as a .size file.
4 * Uses `nm --print-size` and `addr2line` to extract size information
5 * nm's correctness can be somewhat suspect at times...
6 * Produces an html report with bloat grouped by source path.
7 * Produces an "nm"-formatted dump of symbols with their sources resolved by
8 addr2line.
9 * For Chrome, takes ~60 minutes on a z620, but --jobs=10 reduces to ~5 minutes
10 (**at the cost of 60GB of RAM**).
11 4
12 ## Example Usage: 5 ## Example Usage:
13 6
7 # Android:
8 gn gen out/Release --args='target_os="andriod" is_official_build=true'
estevenson 2017/03/20 14:13:02 nit: s/andriod/android
agrieve 2017/03/20 19:58:09 Done.
14 ninja -C out/Release -j 1000 libchrome.so 9 ninja -C out/Release -j 1000 libchrome.so
15 tools/binary_size/run_binary_size_analysis.py \ 10 tools/binary_size/analyze.py out/Release/lib.unstripped/libchrome.so.map.gz --output chrome.size -v
16 --library out/Release/lib.unstripped/libchrome.so \ 11 # Linux:
17 --destdir out/Release/binary-size-report \ 12 gn gen out/Release --args='is_official_build=true'
18 --jobs=10 13 ninja -C out/Release -j 1000 chrome
19 xdg-open out/Release/binary-size-report/index.html 14 tools/binary_size/analyze.py out/Release/chrome.map.gz --output chrome.size -v
20 15
21 ## Recommanded GN Args: 16 # create_html_breakdown.py
22 17
23 is_official_build = true 18 Creates an interactive size breakdown as a stand-alone html report.
24 # There's not much point in measuring size without this flag :).
25
26 ## Optional GN Args:
27
28 is_clang = true
29 # Anecdotally produces more stable symbol names over time.
30 enable_profiling = true
31 # Anecdotally makes symbol lookup more accurate.
32 enable_full_stack_frames_for_profiling = true
33 # With enable_profiling, further improves symbol lookup accuracy but
34 # will completely disable inlining, decreasing spatial accuracy.
35
36 # explain_binary_size_delta.py
37
38 Prints a delta of two "nm"-formatted outputs from `run_binary_size_analysis.py`.
39 19
40 ## Example Usage: 20 ## Example Usage:
41 21
42 tools/binary_size/explain_binary_size_delta.py \ 22 tools/binary_size/create_html_breakdown.py chrome.size --report-dir size-rep ort -v
43 --nm1 out/Release/size-report1/nm.out \ 23 xdg-open size-report/index.html
44 --nm2 out/Release/size-report2/nm.out \
45 --showsouces --showsymbols # Optional
46 24
47 # Open Issues 25 # query.py
48 26
49 Use Monorail label [Tools-BinarySize](https://code.google.com/p/chromium/issues/ list?can=2&q=label:Tools-BinarySize). 27 Starts a Python interpreter where you can run custom queries.
28
29 ## Example Usage:
30
31 # Run a single query and exit rather than entering interactive mode:
32 tools/binary_size/query.py chrome.size --query 'all_syms.WhereBiggerThan(100 0)'
33
34 # Enters a Python REPL:
35 tools/binary_size/query.py chrome.size
36
37 # Roadmap:
38
39 Tracked in https://crbug.com/681694
40
41 1. Convert explain_binary_size_delta.py to use new data model.
42 1. More query.py features:
43 * Template Symbols - shows when templates lead to code bloat.
44 * Duplicate Symbols - shows when statics in headers are an issue.
45 * Overloaded Symbols - shows when overloads are excessive.
46 * Per-class / namespace size (no way to distinguish class vs namespace).
47 * Per-Chrome package (Chrome-specific grouping. e.g. name prefixes).
48 * An interactive UI (either drop into python or use a web server).
49 1. More create_html_breakdown.py features:
50 * Convert paths from .o path to .cc path (better breakdowns).
51 * Break down by query.py groupings (use query.py to define GroupBy()s,
52 then render to html graph)
53 1. More analysis.py features:
54 * Find out more about 0xffffffffffffffff addresses, and why such large
55 gaps exist after them.
56 * Use nm to get the full list of symbols that share the same address.
57 1. Integrate with `resource_sizes.py` so that it tracks size of major
58 components separately: chrome vs blink vs skia vs v8.
59 1. Speed up some steps (like normalizing names) via multiprocessing.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698