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

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

Issue 2724253002: V1 of //tools/binary_size rewrite (Closed)
Patch Set: Add repl to query.py 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 gn gen out/Release --args='is_official_build=true'
14 ninja -C out/Release -j 1000 libchrome.so 8 ninja -C out/Release -j 1000 libchrome.so
15 tools/binary_size/run_binary_size_analysis.py \ 9 tools/binary_size/analyze.py out/Release/libchrome.so.map.gz \
estevenson 2017/03/16 19:49:18 nit: use the actual mapfile location out/Release/l
agrieve 2017/03/20 19:58:08 Done. Added linux example as well.
16 --library out/Release/lib.unstripped/libchrome.so \ 10 --output libchrome.size -v
17 --destdir out/Release/binary-size-report \
18 --jobs=10
19 xdg-open out/Release/binary-size-report/index.html
20 11
21 ## Recommanded GN Args: 12 # create_html_breakdown.py
22 13
23 is_official_build = true 14 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 15
40 ## Example Usage: 16 ## Example Usage:
41 17
42 tools/binary_size/explain_binary_size_delta.py \ 18 tools/binary_size/create_html_breakdown.py out/Release/libchrome.so.map.gz \
43 --nm1 out/Release/size-report1/nm.out \ 19 --report-dir out/Release/size-report -v
44 --nm2 out/Release/size-report2/nm.out \ 20 xdg-open out/Release/size-report/index.html
45 --showsouces --showsymbols # Optional
46 21
47 # Open Issues 22 # query.py
48 23
49 Use Monorail label [Tools-BinarySize](https://code.google.com/p/chromium/issues/ list?can=2&q=label:Tools-BinarySize). 24 Starts a Python interpreter where you can run custom queries.
25
26 ## Example Usage:
27
28 # Run a single query and exit rather than entering interactive mode:
29 tools/binary_size/query.py out/Release/libchrome.so.map.gz \
30 --query 'all_syms.WhereInSection("d").WhereBiggerThan(100)'
31
32 # Enters a Python REPL:
33 tools/binary_size/query.py out/Release/libchrome.so.map.gz
34
35 # Roadmap:
36
37 Tracked in https://crbug.com/681694
38
39 1. Convert explain_binary_size_delta.py to use new data model.
40 1. More query.py features:
41 * Template Symbols - shows when templates lead to code bloat.
42 * Duplicate Symbols - shows when statics in headers are an issue.
43 * Overloaded Symbols - shows when overloads are excessive.
44 * Per-class / namespace size (no way to distinguish class vs namespace).
45 * Per-Chrome package (Chrome-specific grouping. e.g. name prefixes).
46 * An interactive UI (either drop into python or use a web server).
47 1. More create_html_breakdown.py features:
48 * Recreate subpath information for .o files stored within .a files.
49 * Break down by namespace rather than path.
50 * Break down by path, then have classes as leafs rather than .o files.
51 1. More analysis.py features:
52 * Find out more about 0xffffffffffffffff addresses, and why such large
53 gaps exist after them.
54 1. Integrate with `resource_sizes.py` so that it tracks size of major
55 components separately: chrome vs blink vs skia vs v8.
56 1. Speed up some steps (like normalizing names) via multiprocessing.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698