| commit | 773982163e23fa039a37447b3a462c96206367f4 | [log] [tgz] |
|---|---|---|
| author | Imre Kis <imre.kis@arm.com> | Tue May 19 12:23:10 2026 +0200 |
| committer | Imre Kis <imre.kis@arm.com> | Thu Jun 11 14:50:19 2026 +0200 |
| tree | ddcea48a2774d7dd3f092ad2e936589c463b4764 | |
| parent | 38d3c9f0ce5d518461e3c23f4702d80c7cb7808f [diff] |
feat: add memory usage analyser tool Add command line tool that reports per-function code size and stack usage from ELF binaries built with Rust stack size metadata. Support table output on stdout by default, and CSV/JSON exports for integration with other tooling. Signed-off-by: Imre Kis <imre.kis@arm.com> Change-Id: I0ed2b14f32c6acc853b2dd79368bf85a9446cc5d
A tool to generate statistics from an ELF file, such as code and stack usage on a per-function basis. Only software implemented in Rust can be analysed through this tool, as it expects symbols to be encoded per Rust mangling rules. Outputs data in a number of formats, such as simple text, CSV or JSON, for possible integration with other tools.
Build the project you want to analyse with stack size metadata enabled.
For a Rust project, this requires the Rust nightly toolchain and the -Zemit-stack-sizes compiler flag. For release builds, also keep debug information in the output file with -C strip=none.
RUSTFLAGS="-Zemit-stack-sizes -C strip=none" cargo +nightly build --release
Build Memory Usage Analyser.
cargo build
Run Memory Usage Analyser on the generated ELF file.
memory-usage-analyser -i path/to/project/target/output
By default, the tool prints a table containing each function's address, stack usage, code size and name.
Export the results if you want to process them with other tools.
memory-usage-analyser -i path/to/project/target/output -O json -o memory-usage.json memory-usage-analyser -i path/to/project/target/output -O csv -o memory-usage.csv
The project is provided under the BSD-3-Clause license, see LICENSE. Contributions to this project are accepted under the same license and must also be made under the terms of the Developer Certificate of Origin, confirming that the code submitted can (legally) become part of the project.
memory-usage-analyser is a trustedfirmware.org maintained project. All contributions are ultimately merged by the maintainers listed below.
Please follow the directions of the Trusted Firmware Processes
Contributions are handled through review.trustedfirmware.org.
Copyright The memory-usage-analyser Contributors.