diff options
author | Damien George <damien@micropython.org> | 2025-08-29 13:46:36 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-09-24 22:09:45 +1000 |
commit | 0d9aafd9f508c89dc13bbf06583f24cbee3fedfa (patch) | |
tree | f425747fee411723914b9b344cebb3a039a7117d /tools/metrics.py | |
parent | 616f35f7f8783c133f67e2eedc6adbf2d26a7e47 (diff) |
tools/metrics.py: Compute mpy-cross size as part of size metrics.
Add support to `tools/metrics.py` to compute the size delta of mpy-cross,
alongside the sizes of port firmware. This is an easy and cheap addition
because mpy-cross is usually built before the ports are.
Although the size of mpy-cross is not critical, it's still a nice
indication of how changes affect code size, and helps to eliminate any
unwanted increases in mpy-cross.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tools/metrics.py')
-rwxr-xr-x | tools/metrics.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/metrics.py b/tools/metrics.py index f6189e65a..150b40bff 100755 --- a/tools/metrics.py +++ b/tools/metrics.py @@ -57,6 +57,8 @@ class PortData: self.needs_mpy_cross = dir not in ("bare-arm", "minimal") +mpy_cross_output = "mpy-cross/build/mpy-cross" + port_data = { "b": PortData("bare-arm", "bare-arm", "build/firmware.elf"), "m": PortData("minimal x86", "minimal", "build/firmware.elf"), @@ -142,6 +144,8 @@ def do_diff(args): max_delta = None for key, value1 in data1.items(): value2 = data2[key] + if key == mpy_cross_output: + name = "mpy-cross" for port in port_data.values(): if key == "ports/{}/{}".format(port.dir, port.output): name = port.name @@ -207,6 +211,10 @@ def do_sizes(args): ports = parse_port_list(args) print("COMPUTING SIZES") + + if any(port.needs_mpy_cross for port in ports): + syscmd("size", mpy_cross_output) + for port in ports: syscmd("size", "ports/{}/{}".format(port.dir, port.output)) |