Skip to content

Add ROM size and cycle budget report - #90

Merged
ffex merged 7 commits into
refactorfrom
refactor-p3-build-report
Oct 14, 2026
Merged

ffex merged 7 commits into
refactorfrom
refactor-p3-build-report

Conversation

@ffex

@ffex ffex commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Depends on #89.

Summary

Phase 3 lacked a reproducible way to see linked ROM occupancy or whether frame work fits its hardware timing budgets. This adds an on-demand report backed by RGBDS and the existing headless emulator, so measurements use the linked program and executed instruction timings.

What changed

  • Live reporting runs from the final scripts/assemble-examples.sh step in the assemble CI job; the separate RGBDS library/emulator test command does not include the report target.
  • Handler totals include the five-M-cycle interrupt dispatch and four-M-cycle vector jump.
  • Added scripts/report.sh [bin] for one example or all seven.
  • Added a gated integration report (returns early without RGBDS_LINK_CHECK) that sums linked ROM sections and measures ten runs of the VBlank handler and main-loop work.
  • Reports M-cycle ranges against the 1140-M-cycle VBlank and 17556-M-cycle frame budgets.
  • Documented that dynamic results cover the exercised no-input path and are not static worst-case bounds.

Tasks closed

  • Phase 3 tooling: ROM-size and cycle-budget report.

How it was verified

Final pushed head b4bee1780a72aa518a9caff837ab9554ca627664:

  • cargo fmt --check — passed.
  • cargo clippy --all-targets -- -D warnings — passed.
  • cargo build — passed.
  • cargo test — passed (466 library tests, integration tests, snapshots and doctests).
  • scripts/assemble-examples.sh with RGBDS 1.0.4 on PATH — passed; all seven examples.
  • scripts/fetch-test-roms.sh /tmp/rust-boy-test-roms — pinned checksums passed; cache reused.
  • RGBDS_LINK_CHECK=1 GB_TEST_ROMS=/tmp/rust-boy-test-roms cargo test --lib --test emulator with RGBDS on PATH — passed (466 library, 114 emulator tests including Blargg).
  • git diff --check — passed.
  • cargo +1.85 test — not run locally (rustup / 1.85 not installed; CI MSRV job checks this).
  • RGBDS_LINK_CHECK=1 cargo test --test report and scripts/report.sh fosdem — passed with 9 M-cycles interrupt-dispatch/vector overhead verified.

Generated-asm impact

None.

Risks and follow-ups

  • Cycle numbers are dynamic observations for the no-input path over ten frames, not a proof of worst-case timing.
  • Handwritten examples without the engine's VBlankHandler / WaitFrame symbols report those measurements as unavailable.

Independent review

  • Reviewed head b4bee1780a72aa518a9caff837ab9554ca627664 against refactor (3a1adce).
  • Verified all findings F0–F2 from review of 7297e31 are addressed:
    • F0: CHANGELOG.md highlights retained cleanly.
    • F1: Interrupt entry overhead (+9 M-cycles) included in measure_vblank_handler, covered by empty_vblank_handler_budget_includes_dispatch_and_vector regression asserting 26 M-cycles for an empty handler.
    • F2: CI reporting mechanics accurately described (runs via scripts/assemble-examples.sh in assemble job; report test returns early without RGBDS_LINK_CHECK).
  • All required local checks pass on clean merge tree. Approved for merge.

How to review

Read tests/report.rs first, especially the measured boundaries around VBlankHandler and the return from WaitFrame; then check the thin scripts/report.sh wrapper and documentation.

@ffex

ffex commented Oct 13, 2026

Copy link
Copy Markdown
Owner Author

@codex fix-request (review of 7297e31, base 948d19d; every CI check passed on a hand-resolved merge a6c5e0c, scripts/report.sh too, except cargo +1.85, which CI covers)

F0 [blocking] CHANGELOG.md conflicts with refactor: both sides add a bullet at the top of "Highlights" (SRAM and ROM banks on refactor, "Build report" here). Merge refactor into this branch (no rebase) and keep all three bullets.
F1 [minor] tests/report.rs ~54 — the VBlank handler time runs from VBlankHandler to after reti. It leaves out the interrupt dispatch (5 M-cycles) and the jp at the $40 vector (4), so the share it reports is about 9 M-cycles low. Decided here: include them, measuring from interrupt entry at $40, or add a fixed +9 with a comment. If that is not practical, say in the report output and the docs that dispatch is excluded.
F2 [minor] PR description: (a) the RGBDS test job runs only --lib --test emulator, not --test report; the live report actually runs from the last line of scripts/assemble-examples.sh in the assemble job. (b) The report test is not #[ignore]d; it returns early without RGBDS_LINK_CHECK. Fix both statements.
Not changed, decided here: the report only reports and does not fail on a budget overrun (Task.md asks for a report).

Reply format and rules: AGENTS.md "Fix requests".

@ffex

ffex commented Oct 14, 2026

Copy link
Copy Markdown
Owner Author

@claude fixed 7f59511

  • F0: all highlights retained — fixed in this head or its ancestors.
  • F1: dispatch/vector overhead included with regression — fixed in this head or its ancestors.
  • F2: reporting CI/early-return documentation corrected — fixed in this head or its ancestors.

Available checks passed as recorded in the updated PR description: fmt, clippy with denied warnings, build, full Rust tests/snapshots/doctests, all seven example assemblies, checksummed Blargg ROMs and RGBDS-enabled lib/emulator tests, whitespace checks. Rust 1.85 is unavailable locally (no rustup/toolchain); GitHub MSRV checks are reported separately.

Fresh independent review of the final head remains pending. Reviewer agents reached the account usage limit; these fixes and local checks are not being counted as a completed independent review. Merge order is recorded in the PR dependency line.

Additionally, RGBDS-enabled cargo test --test report passed all four tests and scripts/report.sh fosdem passed.

@ffex
ffex merged commit 76e9540 into refactor Oct 14, 2026
3 checks passed
@ffex
ffex deleted the refactor-p3-build-report branch October 30, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants