Add embedded code-size benchmarking scripts#265
Open
AaronWebster wants to merge 1 commit into
Open
Conversation
scripts/embedded_bench.sh cross-compiles a small freestanding driver that forces LargeConditionals::Ok() into an object file, then reports the object's `size` totals and the Ok() symbol size on: * ARM Cortex-M4 Thumb-2 (arm-none-eabi-g++) * MicroBlaze big-endian (microblaze-buildroot-linux-gnu-g++) * Host x86-64 (reference) -ffunction-sections/-fdata-sections keep the per-symbol and TU numbers comparable across compiles; EMBOSS_BENCH_FLAGS overrides the flags and missing toolchains are skipped with a warning. The measured header is refreshed from the live generator via scripts/regenerate_goldens.py. scripts/profile_tool.py drives embedded_bench.sh across multiple git revisions and compiler configurations, pulling the schema and harness forward from the starting revision so the comparison measures generator output rather than the test surface. It writes a markdown report of TU and per-symbol sizes with deltas against the baseline revision.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two developer scripts under
scripts/for measuring the static code size ofEmboss-generated C++ across embedded toolchains and git revisions, so the ongoing
Ok()/ switch code-generation work can be quantified on real targets.scripts/embedded_bench.sh [out-dir]Cross-compiles a tiny freestanding TU that forces
LargeConditionals::Ok()(fromtestdata/many_conditionals.emb, a 100-waytagswitch) into an object file, thenreports the object's
sizetotals and theOk()symbol size vianm --size-sorton:
arm-none-eabi-g++)microblaze-buildroot-linux-gnu-g++)g++, reference)-ffunction-sections/-fdata-sectionskeep the per-symbol and TU numberscomparable across compiles;
EMBOSS_BENCH_FLAGSoverrides the compiler flags; andany missing toolchain is skipped with a warning rather than failing the run. The
measured header is refreshed from the live generator via
scripts/regenerate_goldens.py, so only the out-dir is written.scripts/profile_tool.py --revisions <a> <b> ... [--configs cfg.json] [--out-dir dir]Drives
embedded_bench.shacross multiple git revisions and compilerconfigurations (default
Os/O2/O0). It pulls the schema and harness forwardfrom the starting revision so the comparison measures generator output rather than
the test surface, then writes
<out-dir>/profile_report.mdcontaining, for eachtarget and optimization level, the TU and per-
Ok()-symbol sizes for everyrevision with deltas against the baseline revision. Requires a clean tree and
restores the original branch on exit (including on failure).
Notes
scripts/are standalone dev tools and arenot part of any Bazel target.
testdata/many_conditionals.emb, its golden, andscripts/regenerate_goldens.py) already exist onmaster.