panel: VICTORY_PANEL_LOG=1 logs the HUD's numbers at each refresh #401
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/lobomfz--VIctory-xmem!401
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-401"
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?
@h-dowd on GitHub · 2026-12-04 00:23 UTC · original
h-dowd:panel-log→main· +36 −0 · 2 files · 1 commits · openThe performance panel shows frame rate, 1% low, hitches, submit, copy and upload times, draws and memory, but only on screen, so a session can't be read back afterwards.
With
VICTORY_PANEL_LOG=1, each panel refresh (every 250 ms while the panel is shown) also writes onepanelinfo line with the same numbers:fps,ms,low_1pct_fps,worst_ms,hitches_10s,cpu_pct,sys_cpu_pct,submit_ms,gpu_idle_ms,cpu_wait_gpu_ms,copy_prep_ms,tex_upload_ms,upload_mb,draws,dropped_draws,vram_used_mb,vram_budget_mb,shared_mb,title_card_mb,title_ram_mb,tex_waiting,working_mb,sys_avail_mbI used it to bucket fps by draw count and to line hitches up with submit-thread and upload spikes across whole sessions. That showed which scenes drop and that the hitches near land come from streaming bursts, which the per-second
stats: frameline averages away.OnceLockread per refresh, nothing else.PROFILE=diag.docs/DIAGNOSTICS.md.🤖 Generated with Claude Code
@Kal0s-design on GitHub · 2026-12-04 07:36 UTC · original
Checked
728df1e. Looks fine overall, one suggestion about which thread does the write, rest are small.The switch is read once into a OnceLock and only
1turns it on, same shape asVICTORY_TIMER_LOGin frame.rs:292 (panel.rs:2185-2186). It sits inside the 250 ms refresh block, after the early return at panel.rs:2125, so per-frame work is unchanged, and with it off the refresh only pays one OnceLock read. No allocation or formatting happens unless it's on.When on it is one
tracing::info!per refresh, through the shared subscriber to stderr (victory-core/src/logging.rs:30-32). The game inits it atinfo(apps/victory/src/main.rs:191) and release caps at info (logging.rs:14-18), so "Release builds too" holds. The line only appears while the panel is not hidden and the menu is closed (panel.rs:2084-2092), which matches "while it is shown". The block itself adds no lock,dropped_nowis an atomic load (draw.rs:640-641).The one thing I'd change is where the write happens.
frame()is called frompresent_realwhile the presenter is borrowed (victory-gpu/src/host.rs:9170), so the log write and its stderr lock sit on the present path, about four times a second. The frame meter's own periodic lines are deliberately handed to the "victory-meter" thread "so presenting goes on" (host.rs:7755-7760). All the logged values are Copy, so wrapping theinfo!insuper::meter_lines(move || ...)should be a small change and keep the present thread free of log writes. Its cost does at least show up in the HUD's overlay line on the next refresh, sinceself.costis taken after it (panel.rs:2266).The fields come from the same locals the Snapshot is built from, so they match the HUD. Smaller notes.
gpu_idle_msis the rawc[1], while the HUD shows GPU busy asms - min(idle, ms)(panel.rs:1199-1200, 1389). Anyone reading the log has to do that subtraction and clamp themselves. Logginggpu_busy_msinstead, or next to it, would line up with what's on screen.dropped_now()is read twice, once for the log (panel.rs:2204) and once for the Snapshot (panel.rs:2234). It's a plain atomic load (draw.rs:640-641) so the two can differ by a few draws. Reading it once into a local would keep the log and HUD identical.b >> 20, panel.rs:2188), the HUD shows GB with two decimals. Finer in the log, which is fine, just a different unit.VICTORY_LOG=warnhides it. Might be worth a word in DIAGNOSTICS.md:19.upload_mbanddrawsare per frame too (they come fromCounters::since, panel.rs:804-811). Could say so in the field name or doc.git grep VICTORY_PANEL_LOGfinds only panel.rs:2182,2186 and docs/DIAGNOSTICS.md:19. rustfmt --check is clean on panel.rs.Tests ran natively on Windows (MSVC, not Wine).
cargo test -p victory-gpu --lib panelbuilt with no warnings, but the filter only matcheshost::panel::tests::preview, which is#[ignore](panel.rs:2537), so the result is 0 passed, 0 failed, 1 ignored. Nothing actually exercises the new block, so this is a build check, not a test. I didn't add a test for the log line, since the formatting is inline inframe()and testing it would need pulling it into its own function first.AI-assisted: yes
@Luxuride on GitHub · 2026-12-04 11:28 UTC · original
Useful, and the units check out:
EVERYis 250 ms (host/panel.rs:49) so the documented interval is right,video_memory()/system_ram()really are bytes, andc[0..=9]is in range for the 11 counters.One doc clause worth adding:
dropped_drawscomes fromcrate::draw::dropped_now()(crates/victory-gpu/src/draw.rs:640), a since-start total, while every other field on the line is per-window — the first person to plot this will read it as a per-window draw loss.Two cosmetic nits:
drawstruncates a fractional average (c[9] as u64), andmbshifts (b >> 20) where the HUD shows one decimal, so 1023.9 MiB logs as 1023.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.