Skip to content

benchmarks: Record full-app recording runs and report the 5% gate (Refs #1305) - #1410

Merged
zackees merged 6 commits into
obs-rust:masterfrom
vpacher:test/1305-recording-runner
Oct 18, 2026
Merged

zackees merged 6 commits into
obs-rust:masterfrom
vpacher:test/1305-recording-runner

Conversation

@vpacher

@vpacher vpacher commented Oct 18, 2026

Copy link
Copy Markdown
Member

Stacked: on #1405 (the first two commits). Review only the last four commits; I rebase this PR after #1405 merges.

Refs #1305

What and why

#1305 needs C/Rust full-app recording evidence for the 5% gate in docs/rust-port/release-criteria.md: independent interleaved runs, medians and ranges, hardware rendering, no profiler. This PR adds the runner and the report. The results on release hardware follow as a comment on #1305.

rust/tools/benchmarks/recording.py:

  • run: records once from an OBS that is already running with the scene and profile under test.
    1. Runs ci/recording_evidence_check.py (ci: Check the renderer and the mapped libobs of a recording evidence run (Refs #1305) #1405) on the log and the mapped libraries. A software renderer, the other backend or a library from outside --prefix stops the run before it measures.
    2. Starts the recording, waits --warmup seconds, samples GetStats every second for --seconds, and reads the recording output's GetOutputStatus at the start and the end.
    3. Stops the recording and checks that the expected encoder (--encoder, e.g. obs-nvenc) logged its settings for this recording. OBS logs them before the ==== Recording Start marker, and the frame summary after it.
    4. Writes one JSON: host, identity, conditions (video settings, recording profile keys, scene, source version), encoder log lines, file, metrics and the raw samples. --delete-recording removes the file, also when a check fails.
  • report: compares the run files. It refuses fewer than 5 runs per backend, different conditions, renderers or graphics modules, and two builds of one backend. It gives median and range per backend and the Rust/C ratio for frame render time (median, p95), CPU and the render, output and encoder skip rates. Gate: Rust frame time median at most 1.05 x C; no skip rate above 1.05 x C; when C has no skips, Rust must have none. Exit code 2 when the gate fails.

The script does not switch the backend. Switching needs an OBS restart with another library path, and that is host-specific. docs/rust-port/release-criteria.md describes the procedure.

GetStats counts the frames of all video outputs (an NDI output next to the recording doubles outputTotalFrames), so the encoder skip rate comes from the recording output's own counters.

RED → GREEN

  • RED commit: 7dd943d. recording.py is a stub; 17/17 tests in ci/test_recording_benchmark.py fail.
  • GREEN: 94d5a8f, 18/18 (one test added for the log header version). 248d89d: docs. Last commit: the test loads recording.py by path (test_ci_tests_stdlib_only.py, ci: the local gate's lint lane fails without a system PyYAML (test_ccache_launcher_installed.py) #1196). Full ci/ suite on macOS: no new failures (the 8 failures before this change are Linux-only tests and stay the same).
  • Real app: Debian 13 LXC, RTX 3060, NVIDIA 595.104.02, fork 9f573a9, Rust libobs, 4K25 with an NDI output active, NVENC H.264:
    • The first smoke run failed closed: the encoder check looked only after Recording Start, but OBS logs the encoder settings before it. Fixed in RED/GREEN before this PR.
    • Second run: pass. 30 s, 31 samples, 750 frames, 0 render/output/encoder skips, median frame render time 3.16 ms (p95 3.41 ms), encoder obs-nvenc H.264 found, file deleted.

Checklist

  • Base is master (or the description starts with a Stacked: note)
  • I claimed the issue, or no one else has an open PR for it
  • Characterization test (if the unit had none), then RED, then GREEN commits (new tool, no characterization needed)
  • User-visible change: its line in docs/features.md is added or updated (not applicable: no user-visible change)
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes (-W..., ratchets): not applicable
  • Intentional differences from C listed in the parity test header and rust/README.md (ports): not applicable

🤖 Generated with Claude Code

vpacher and others added 6 commits October 18, 2026 10:13
…mapped libobs (Refs obs-rust#1305)

RED: the check is a stub, 19/19 tests fail. The tests reject llvmpipe,
softpipe and WARP renderers, the wrong libobs backend, two or zero libobs,
a missing graphics module, a graphics module from outside the install
prefix and a deleted mapping, and accept the hardware setup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…run (Refs obs-rust#1305)

GREEN: 19/19. recording_evidence_check.py reads the OBS log and a copy of
/proc/<pid>/maps (or vmmap/lsof output on macOS). It fails when the log
shows a software renderer (llvmpipe, softpipe, swrast, lavapipe, WARP,
Apple Software Renderer) or more than one renderer, when the mapped
libobs is not the expected backend (Rust twin told apart by its /rustc/
paths, as in release-rust.yaml since obs-rust#1253), when not exactly one libobs
and one graphics module are mapped, when a mapping was deleted, or when
a library comes from outside --prefix (a stock libobs-opengl from the
system lib dir next to our libobs). On success it prints the run identity
(renderer, paths, SHA-256) as JSON for the evidence report.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…(Refs obs-rust#1305)

RED: recording.py is a stub, 17/17 tests fail. The tests cover per-run
metrics from GetStats/GetOutputStatus samples (frame counts, render and
encoder skip rates, median frame render time and CPU; a counter that
goes back, too few samples, no frames or an inactive recorder fail), the
C/Rust report (medians and ranges per backend, Rust/C ratio, the 5%
frame-time and dropped-frame gates, at least 5 runs per backend, refusal
of mixed conditions, renderers, encoders or two builds of one backend),
its Markdown table and the encoder evidence from the OBS log.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
obs-rust#1305)

GREEN: 18/18 (+19/19 for the evidence check). `recording.py run` records
from a running OBS after ci/recording_evidence_check.py passes: it starts
the recording, waits for warm-up, samples GetStats every second, reads
the recording output's counters at the start and the end, stops, checks
that the expected encoder logged its settings for this recording and
writes one JSON file (host, identity, video/profile/scene/source
conditions, encoder log lines, file, metrics, raw samples). It can
delete the file afterwards, also when a check fails. `recording.py
report` compares at least 5 runs per backend with the same conditions
and gives medians, ranges, the Rust/C ratio and the frame-time and
dropped-frame gates; exit 2 when the gate fails.

OBS logs the encoder settings before the "Recording Start" marker and
the frame summary after it; the encoder check reads both.

Smoke run on Debian 13 / RTX 3060 / fork 9f573a9, Rust libobs, NVENC
H.264, 4K25 with an NDI output active: 30 s, 750 frames, 0 render /
encoder skips, 3.16 ms median frame render time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ci/ tests import only the standard library and ci/ modules
(test_ci_tests_stdlib_only.py, obs-rust#1196). recording.py needs websockets only
for a live run, so loading it by path keeps the test on a plain Python.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vpacher
vpacher requested a review from zackees as a code owner October 18, 2026 08:34
@zackees
zackees added this pull request to the merge queue Oct 18, 2026
Merged via the queue into obs-rust:master with commit 29f245b Oct 18, 2026
22 checks passed
@vpacher
vpacher deleted the test/1305-recording-runner branch October 18, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants