Diagnostics: copystat's per-frame figures divide by the frames of their own 5 s interval (they read 1.5-6x too high) #213
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!213
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-213"
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?
@MamaLeVrai on GitHub · 2026-11-25 23:55 UTC · original
MamaLeVrai:copystat-interval→main· +10 −5 · 1 files · 1 commits · openIn diagnostics builds, the
copies per frame: …line (copystat::log) and itscopied from … x/framelines divide counters gathered over about 5 s by the frame count of the last 1 s only.Where.
Meter::frame(crates/victory-gpu/src/host.rs) computesframesfor a one-second window and resets it every second. The copystat counters are only swapped to zero inside theif self.logged.elapsed() >= 5 sblock, so they hold about 5 s of work, andcrate::copystat::log(frames)divides them by that one second's frames. The page-fault count in the same line has the same problem. At 2 to 4 fps the per-frame figures come out about 1.5 to 6 times too high, depending on how many frames the last second had. They are only right when one frame spans the whole interval.This matters for reports that quote them. #151 cites 21-38 GB "refreshed per frame". In two runs on my machine the same line said up to 23 GB per frame, while the fps line's
copies … MB(the bytes actually copied, over the same one-second window as its frame count) said 35-121 MB a frame.The change.
TIMED_FRAMESalready counts the frames presented since the last 5 s line;log_gpu_timesused it for the same purpose. It is now read once in that block and passed to bothlog_gpu_timesandcopystat::log. Diagnostics builds only; release builds are unchanged.Checked.
cargo clippy --release -p victory-gpu --features diagnostics --no-depsbuilds with no new warning. I have not run the game with it.AI-assisted (Claude Code); no game data.
🤖 Generated with Claude Code
@KernelSmoker on GitHub · 2026-11-26 00:25 UTC · original
I cross-checked PR #213 with
cargo check --target x86_64-pc-windows-gnu -p victory-gpu --features diagnostics(passed; compile check only). Static review found a counter edge case:TIMED_FRAMES.swapruns beforelog_gpu_times, which returns early whenGPU_TIMESisNone(usual unlessVICTORY_GPU_TIMINGpopulated it). The swap still consumes the frames, socopystat::log(interval_frames)can then use 1 and retain the overcount. Could you move ownership of the swap so copy stats always receive the interval frame count? I recorded the validation at https://github.com/KernelSmoker/VIctory-Belobug-AMD/blob/testreports/2026-11-27/reports/2026-11-27-pr213-windows-compile.md@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 23:56 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@MamaLeVrai on GitHub · 2026-11-26 04:59 UTC · original
Thanks for the cross-check under the GNU target. I think the swap already lives where you suggest. The PR takes
TIMED_FRAMES.swap(0, …)out oflog_gpu_times, which now only takesframes: f64as an argument. The swap happens once, inMeter::frame's 5 s block, intointerval_frames, and that one value is passed to bothlog_gpu_times(interval_frames)andcrate::copystat::log(interval_frames). So whenlog_gpu_timesreturns early (noGPU_TIMES), nothing has been consumed on its account, and copystat still gets the interval's frame count. The relevant lines of the diff:If I have missed a path, please point me to it.
AI-assisted (Claude Code); no game data.
@adrianmjim on GitHub · 2026-11-26 19:51 UTC · original
Tested natively on Windows 11 (MSVC toolchain, RX 7900 XT), head
ccbf888against base4f62c2a.cargo clippy -p victory-gpu --features diagnostics --no-deps --all-targets: same warnings as on base, none new.cargo test -p victory-gpu --lib --features diagnostics: no test reachesMeter::frame, so this only shows the build is fine. The failures I saw were intermittentwatch::tests,pipeline::libraryandqueuetests that also fail on base. There was also onequery::testsfailure, seen once, on the PR side only.Meterat 3 fps for about 6.6 s with a null HWND. It adds 1 MB of title copies per frame throughcopystat::add/copystat::rangeand reads the logged line.title copies4.2 to 5.3 MB/frame,copied from4.2x to 5.3x per frame (4 runs).On the edge case raised above: that test ran without
VICTORY_GPU_TIMING. SoGPU_TIMESwasNoneandlog_gpu_timesreturned early.copystat::logstill got the interval's frame count.TIMED_FRAMESis incremented on every present in diagnostics builds, whether or not GPU timing is on.So the frame count is not lost there.
Not tested: running the game with this build, and the page-fault figure in that line.
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.