Commit Graph

9 Commits

Author SHA1 Message Date
Mathias Agopian
d07c15dfc6 zbloat: modernize script
The script uses os.system to execute external commands like nm and 
objdump. Instead we use the subprocess module, which is the recommended 
approach in modern Python. 
Properly handle potential errors if nm or objdump fail.
2025-09-04 08:37:18 -07:00
Mathias Agopian
1422116242 zbloat: fix warnings 2025-09-04 08:37:18 -07:00
Mathias Agopian
28fcbe2b77 zbloat: add support for .a 2025-09-04 08:37:18 -07:00
Ben Doherty
2ae4ee85e0 Fix IndexError in zbloat tool (#6802) 2023-05-11 11:43:33 -07:00
Philip Rideout
101a59138c Update the zbloat tool
The tool now works with Python 3 and handles binaries that have multiple
embedded material archives.
2022-03-21 16:13:49 -07:00
Philip Rideout
1a9334e818 Modernize Python print syntax. 2021-02-23 14:43:30 -08:00
Philip Rideout
a50cd1f8c8 zbloat now includes chunk sizes 2020-12-06 21:54:37 -08:00
Philip Rideout
fe907398d4 resgen / zbloat fixups 2020-12-06 15:25:08 -08:00
Philip Rideout
8b6ddfe97a Add zbloat tool.
This tool makes it easy to analyze the composition of Android
applications that use Filament.

- Filament materials are shown in the treemap if `resgen --json` was
  used in the build.
- The input path can be a so file, folder, or zip archive (apk or aar).
- If the path is a zip or folder, helps you find the file to analyze.
- The generated web report is a self-contained HTML file.
- Reports the gzipped size of all Filament materials.

For example, from a mac, you can generate a self-contained HTML file by
typing this from the Filament repo root:

    ./tools/zbloat/zbloat.py ./android/filament-android
    open index.html

This tool uses Python, `nm`, and `objdump`.

The `nm` tool works slightly differently between macOS and Linux, so a
`Dockerfile` is provided that installs dependencies inside a Linux
container. This is also convenient if you do not have both versions of
Python on your system.

The easy way to use docker is to invoke the helper bash script. Simply
type `zbloat.sh [args...]` instead of `zbloat.py [args...]`. The first
time you run it, it will be slow but subsequent times will be fast.

Many thanks to Evan Martin for his interactive treemap widget.
2020-12-06 14:36:25 -08:00