tree: 1e04181d4e196ff6538c31b2c100fc1cb1d91d85 [path history] [tgz]
  1. template/
  2. testdata/
  3. console.py
  4. create_html_breakdown.py
  5. describe.py
  6. diagnose_apk_bloat.py
  7. file_format.py
  8. function_signature.py
  9. function_signature_test.py
  10. helpers.py
  11. integration_test.py
  12. linker_map_parser.py
  13. map2size.py
  14. match_util.py
  15. match_util_test.py
  16. models.py
  17. ninja_parser.py
  18. OWNERS
  19. PRESUBMIT.py
  20. README.md
tools/binary_size/README.md

map2size.py

Parses a linker .map(.gz) file and outputs the result as a .size(.gz) file.

Example Usage:

# Android:
gn gen out/Release --args='target_os="android" is_official_build=true'
ninja -C out/Release -j 1000 libchrome.so
tools/binary_size/map2size.py out/Release/lib.unstripped/libchrome.so.map.gz chrome.size -v
# Linux:
gn gen out/Release --args='is_official_build=true'
ninja -C out/Release -j 1000 chrome
tools/binary_size/map2size.py out/Release/chrome.map.gz chrome.size -v

create_html_breakdown.py

Creates an interactive size breakdown as a stand-alone html report.

Example Usage:

tools/binary_size/create_html_breakdown.py chrome.size --report-dir size-report -v
xdg-open size-report/index.html

console.py

Starts a Python interpreter where you can run custom queries.

Example Usage:

# Runs a single diff and exits (does not enter interactive mode).
tools/binary_size/console.py without_patch.size with_patch.size --query='Diff(size_info2, size_info1)'

# Enters a Python REPL (it will print more guidance).
tools/binary_size/console.py chrome.size

diagnose_apk_bloat.py

Determine the cause of binary size bloat for a patch.

Example Usage:

# Sync, build, and store MonochromePublic.apk for HEAD and HEAD^.
tools/binary_size/diagnose_apk_bloat.py -v

# Display detailed usage info (there are many options).
tools/binary_size/diagnose_apk_bloat.py -h

Roadmap:

Tracked in https://crbug.com/681694

  1. More console.py features:
    • Template Symbols - shows when templates lead to code bloat.
    • Duplicate Symbols - shows when statics in headers are an issue.
    • Overloaded Symbols - shows when overloads are excessive.
    • Per-class / namespace size (no way to distinguish class vs namespace).
    • Per-Chrome package (Chrome-specific grouping. e.g. name prefixes).
    • CSV output (for pasting into a spreadsheet).
  2. More create_html_breakdown.py features:
    • Break down by other groupings (e.g. create from nested SymbolGroups)
  3. More map2size.py features:
    • Find out more about 0xffffffffffffffff addresses, and why such large gaps exist after them.
    • Use nm to get the full list of symbols that share the same address.
  4. More diagnose_apk_bloat.py features:
    • Add diffing functionality to see diff stats for two commits.
    • Add --cloud option for using artifacts from perf builders.
  5. Integrate with resource_sizes.py so that it tracks size of major components separately: chrome vs blink vs skia vs v8.
  6. Speed up some steps (like normalizing names) via multiprocessing.
  7. Use resource whitelist information to attribute .pak file size to .o files.
  8. Add dependency graph info, perhaps just on a per-file basis.