watch: waits for the guards' lock are charged to the place holding it #3604
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3604"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by ACSchafer on 2026-11-30T01:36:39Z.
What it changes
In a diagnostics build,
guards()records its caller (track_caller) while it holds the lock. A thread that has to wait reads that before it blocks, and charges its wait, once it has the lock, to the holder and to its own call site. The frame statistics get a line:waits for the guards' lock per frame, by the place holding it: watch.rs:NNNN 1.23 ms in 45, ...; by holder <- waiter: ...Other builds are unchanged: everything is behind
cfg(feature = "diagnostics").How it was tested
waits for the write trackers' locks per framesays how long threads wait, not for whomwatch::tests pass with--features diagnostics.cargo testpassed for the crates it touches: yes.cargo clippy -p victory-gpu --all-targets, with and without--all-features, adds no warnings.Checked for overlap
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-30T01:36:49Z.
Review: COMMENTED
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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mstrmoos on 2026-11-30T03:28:58Z.
Ported this onto main
41adb551and read it in a game session. It found a real one.VICTORY_COPY_BESIDE=1, 150 s in an outdoor save.guard()'s retake of the lock after the unsure loop held it for 31.5 ms of other threads' waits. Then cameguard()'s per-run retake (10.2 ms) andopened_for_writing(7.1 ms).opened_for_writing <- opened_for_writing(5.9 ms in 53) andguard <- opened_for_writing(11 ms). These are the title's copies (titlewrite) opening a block that has had its share of copies beside the guard. Unlike faults, they still take the lock.opened_for_writingwas called 764 times and waited 346 ms in all, up to 17 ms at a time, while itsVirtualProtecttook 0.2 ms in all.opened_for_writingnow usesopen_unlockedas a fault does, and leaves the write to fault into the handler when that declines.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.