[pr-fix] Calculate frame-time percentiles inside the requested benchmark window #172
Loading…
Reference in a new issue
No description provided.
Delete branch "akimfomin/Darner:codex/bench-frame-window"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
Fluxer ID omitted.
What it changes
The benchmark used the timestamp of a five-second diagnostic message to select every frame in that batch. A stall before the requested window could inflate p99, and a short window between messages could have zero frames. This change uses the batch timestamps and the recorded precision of each frame length to keep complete intervals inside the requested window. The report flags ambiguous boundary frames and explains missing coverage. Comparing older summaries also identifies their original percentile method.
How it was tested
57dea7f236. The published tree at228427ce57is identical to the locally tested tree at15a483385f.Invoke-Pester -Script scripts/tests/bench-window.Tests.ps1passed 5/5 on Windows PowerShell 5.1.cargo run --quiet --locked --offline -p xtask -- policypassed.scripts/bench.ps1 -Fromon separate copies of the same archived camera run. Compared each result with complete frame intervals from its timestamped CSV. Times below are p99 in milliseconds.The text log has coarser precision than the CSV. The two one-frame differences are at the window boundary. Coverage was offline with archived data and synthetic fixtures. No new gameplay sample or workspace-wide Clippy/test gate was run.
Checklist
main.docs/asset-policy.md.Checked for overlap
Independent offline check against main
ad070f0and PR228427ce, using the fullscripts/bench.ps1 -Frompath on Windows PowerShell 5.1. The five Pester tests also passed.With a 1,000 ms pause at t=1 s in the batch printed at t=5 s, the 4–6 s window reports 41 frames / p99 1,000 ms on main and 9 complete frames / p99 100 ms on the PR. The PR's
smoothness.longest_gap_msstill reports 1,000 ms, with the event stamped at t=1 s. That field continues to describe the batches printed in the window, alongside the newly clipped percentiles.I found one remaining edge in
Get-WindowFrameTimes. The 6–8 s window yields 17 frames / p99 100 ms with 100 ms intervals and batch stamps at 0, 5, 10, 15, and 20 s. Changing only the final stamp from 20 to 15 s after the requested window gives 0 frames / p99 unavailable, even though the window is already bracketed. The non-positive span check runs before filtering the disjoint tail.In a local trial, skipping a pair when both timestamps are past
$to, before checking the span, restored the 17 frames and 100 ms p99. As a control, a reversed pair at 15 s and 7 s that crosses back into the window still withheld the result.Thanks for the reproducer. I reproduced the zero-frame result on
228427ceand fixed it in700df021da. In the 6–8 s window, final timestamps of 20, 15, and 12 s now all preserve 17 complete frames and a 100 ms p99. If the timestamp subsequently returns to 7 s, the benchmark still withholds the percentile and explains why.All seven Windows PowerShell 5.1 Pester tests passed through the offline
bench.ps1 -Frompath. The asset check passed for 554 files. The published tree matches the tested tree. As you noted,smoothness.longest_gap_msstill aggregates batches by their report timestamp.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.