Diagnostics: long frames one by one, with where each one's time went (VICTORY_LONG_FRAMES=<ms>) #452
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/452"
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?
Imported from avatarmanz/VIctory-7900XTX. Originally posted by Jesper-Andersson on 2026-11-27T10:30:30Z.
The frame-rate line and the 5 s
copies per frame/recording per framelines average every frame since the last line, so one 1.5 s frame among fifty of 95 ms hardly moves them: they show which stretches stutter, not what held any one frame. This adds a line for each long frame on its own, with where that frame's time went.Change
VICTORY_LONG_FRAMES=<ms>(diagnostics builds only, off by default;1/on= 250 ms, a number is clamped to at least 50 ms so a steady slow frame rate doesn't log every frame). At each present (copystat::presented) that comes at least that long after the one before, one line:VICTORY_WAIT_RESIDENT, #371);copystat's counters get running totals (CARRIEDkeeps what the 5 s line has taken,total()adds what is there now), and a present diffs them with the totals at the present before (longframe::Sample::since). The 5 s line's taking and a present's reading share a lock (TAKING), so a total is never read between a counter's taking and its carrying. Without the lock that frame would come out short and the next one would get the whole 5 s line's worth.C::CopyUs: the time of the title copies thatC::CopyBytescounts (the 5 s line had that time only inhost.rs'sPREPARING). Newhost::residency_waits_us()reads theresident/mappedwait totals, which are never reset.crates/victory-gpu/src/longframe.rs(threshold parsing, the sample and the line, tests); hooks incopystat.rs,host.rs,lib.rs.Where it does nothing
presented()checks aOnceLockand returns. The extra work on the 5 s line is onefetch_addper counter and an uncontended lock.Measured
I haven't timed what the line itself costs: with the switch on, a present makes three syscalls and sums about 20 counters over 32 banks. Here is what it showed from a local branch (main plus about 50 PRs, not
main), on an RTX 2070 SUPER 8 GB (driver 621.14), Ryzen 7 5800X, 32 GB, Windows 11, diag build, Series S + DLSS,VICTORY_LONG_FRAMES=250:VICTORY_KEEP_PAGES(#447).Checks
cargo test -p victory-gpu --lib --locked longframe: 4 passed (4 new:the_switch_reads_as_a_threshold,a_frame_is_the_difference_of_its_presents_and_never_negative,every_field_of_a_frame_is_that_frame_alone,only_frames_past_the_threshold_make_a_line)cargo clippy -p victory-gpu --all-targets --locked --features diagnostics: no warnings in changed code (6 warnings already on main:texture.rs,host/panel.rs,host/place.rs,host/rtstamps.rsx2,watch.rs)cargo xtask policy: 4 files okNot checked
VICTORY_LONG_FRAMES=1, comparing a long frame's fields with the 5 s line around it.Related
VICTORY_CRITICAL_PATH=1) logs one line every frame with the submitting, recording and relay chains. It has no threshold and no paging or residency fields.VICTORY_KEEP_PAGES) is the fix these lines led to.This change was made with AI assistance (Claude Code).
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.