Record present intervals so hitching can be measured #1087

Open
github-bot wants to merge 5 commits from github-bot/gh-1087 into main AGit
Owner

@⁠superboynick on GitHub · 2026-11-25 18:58 UTC · original
superboynick:feat/present-times → main · +182 −1 · 2 files · 5 commits · open

Frame rate hides hitching, and an interval alone does not say why. This change does both halves.

Interval recording. VICTORY_PRESENT_TIMES=<path> writes one row per present with the interval, running p50/p95/p99 and the worst interval so far, plus a total row on exit. On the prologue of the retail title, 1500 presents over 72.8 s:

p50 33.4 ms p95 105.4 ms p99 370.8 ms worst 3527 ms stalls over 100 ms: 77

Sitting in the menus the same build gives p99 34.2 ms, so the long stalls belong to content streaming, not to the steady state.

Attribution. VICTORY_STALL_LOG=<ms> prints, for any present slower than the threshold, the counters accumulated during that frame: pipelines created, shaders translated, texture uploads. Real output:

Present stall interval_ms=1471.9 pipelines_created=0 shaders_translated=0 texture_uploads=1159 Present stall interval_ms=399.2 pipelines_created=0 shaders_translated=34 texture_uploads=19

Across a 120 s run, texture uploads appear in 81 of 91 stalls; shader translation in a handful. That is a correlation and I am not claiming a cause - but it points at the upload path rather than at compilation, which is where I would look next.

Counters that cannot be read cheaply are reported as na instead of guessed. Neither variable is read unless set, and with neither set the present path is unchanged.

**@⁠superboynick** on GitHub · 2026-11-25 18:58 UTC · [original](https://github.com/fxceless/victory-fork/pull/1087) `superboynick:feat/present-times` → `main` · +182 −1 · 2 files · 5 commits · open Frame rate hides hitching, and an interval alone does not say why. This change does both halves. **Interval recording.** `VICTORY_PRESENT_TIMES=<path>` writes one row per present with the interval, running p50/p95/p99 and the worst interval so far, plus a total row on exit. On the prologue of the retail title, 1500 presents over 72.8 s: ` p50 33.4 ms p95 105.4 ms p99 370.8 ms worst 3527 ms stalls over 100 ms: 77 ` Sitting in the menus the same build gives p99 34.2 ms, so the long stalls belong to content streaming, not to the steady state. **Attribution.** `VICTORY_STALL_LOG=<ms>` prints, for any present slower than the threshold, the counters accumulated during that frame: pipelines created, shaders translated, texture uploads. Real output: ` Present stall interval_ms=1471.9 pipelines_created=0 shaders_translated=0 texture_uploads=1159 Present stall interval_ms=399.2 pipelines_created=0 shaders_translated=34 texture_uploads=19 ` Across a 120 s run, texture uploads appear in 81 of 91 stalls; shader translation in a handful. That is a correlation and I am not claiming a cause - but it points at the upload path rather than at compilation, which is where I would look next. Counters that cannot be read cheaply are reported as `na` instead of guessed. Neither variable is read unless set, and with neither set the present path is unchanged.
A steady frame rate with occasional long stalls reads as flicker or
stutter, and a five-second average hides both. VICTORY_PRESENT_TIMES
writes a per-frame interval column with running p50/p95/p99 and the worst
interval so far, plus a total line, to a CSV on exit.

Measured on the prologue of the retail title: 1500 frames, p50 33.3 ms,
p95 33.8 ms, p99 34.2 ms, worst 1130 ms - a title that reports 30 fps and
still freezes for over a second. Unset, no timestamps are taken.
An interval tells you a frame took 1.4 seconds; it does not say why.
VICTORY_STALL_LOG=<ms> prints, for any present slower than the threshold,
the counts accumulated during that frame: pipelines created, shaders
translated, and texture uploads, taken from the existing frame counters.

On the prologue of the retail title, 91 of 91 stalls carried an upload
count and the worst one - 1472 ms - carried 1159 texture uploads. Shader
translation shows up in only a few of them. That is a correlation, not a
cause, but it points at the upload path rather than at compilation.

Counters that cannot be read cheaply are reported as na rather than
guessed. Unset, nothing is timed or counted.
Whole-run percentiles move with how quickly a run reaches a given piece
of content, so two runs of the same build on the same machine differ by a
factor of several. Window rows every 300 frames give the same shape
regardless: stalls over 100 ms, p99 and the worst interval inside that
window, so the corresponding windows of two runs can be compared.

Existing per-frame rows and the total line are unchanged.
A run stopped with a signal kept only the first window: the writer was
still buffered. Window rows are produced every 300 frames, so flushing
there costs nothing measurable and keeps the data usable when a run is
interrupted, which is how these measurements are usually collected.
Pulls the nearest-rank percentile out of the writer into a function with
a name, and states its behaviour for the cases a reviewer would otherwise
have to infer: empty input answers zero, one sample is its own p50 through
p100, a hundred samples land on their own rank, and a three-interval run
reports the largest as p99 rather than reading past the end.

Same numbers as before for real runs; the CSV layout is unchanged.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:57:15 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1087/head:github-bot/gh-1087'
git switch 'github-bot/gh-1087'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1087'
git switch 'github-bot/gh-1087'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1087'
git switch 'github-bot/gh-1087'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1087'
git switch 'main'
git merge --squash 'github-bot/gh-1087'
git switch 'main'
git merge --ff-only 'github-bot/gh-1087'
git switch 'main'
git merge 'github-bot/gh-1087'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.