Timeline: sleep between sampling scans #3942
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!3942
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3942"
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?
@john-9474 on GitHub · 2026-11-30 12:33 UTC · original
john-9474:codex/timeline-sampler-sleep→main· +144 −9 · 2 files · 1 commits · openThe native timeline sampler busy-waits for 250µs after each scan, so the observer itself consumes roughly a CPU core while recording. Replace that tail spin with
std::thread::sleep(250µs). Sampling remains opt-in through the existing diagnostics timeline; there is no new runtime switch or timer API.This reduces sampling density. Documentation now states the actual contract: scan time plus at least 250µs asleep, with OS wake-up jitter, rather than a fixed 4kHz promise. Longer gaps can miss short work, so comparisons should use actual timestamps and sample counts.
A controlled native off/on/off comparison completed six 20-frame windows, with zero lost events and the registered target thread sampled in every window. The sampler's native CPU estimate fell from 24.9–29.2ms/frame to 1.1–1.2ms/frame. Median sample intervals increased from 266–270µs to about 547µs; p95 increased from 419–608µs to 1,217–1,267µs, with about 54% fewer samples inside the captured frame windows. These are observer-cost/cadence results, not a game FPS claim. The native CPU accounting is a cycle-counter estimate rather than an exact utilization percentage; teardown samples outside the first/last present were excluded from density calculations.
Two ignored, asset-free measurements make the behavior reproducible without a title or GPU:
sample_pacingprints thread CPU cost and wait quantiles for the actual sleep helper and the previous spin;own_workers_are_sampled_and_the_sampler_stopsexercises the real sampler against zero, one and three controlled Rust workers in its own process, checking sample coverage and recording cleanup after scoped joins. The fixture does not change the existing context-reading implementation. Scheduler-dependent timings and whether the sampler was already finished when capture teardown returned are reported rather than imposed as ordinary CI deadlines.Focused validation on Windows:
cargo test --locked --profile diag -p victory-gpu --features diagnostics --lib --no-run; a final repeat confirmed the fingerprint after every source edit. Production-libcargo check --locked --profile diag -p victory-gpu --features diagnosticspassed.real_waitshook test was excluded from this focused run).end()returned in all three cases.git diff --cached --checkpassed.The new measurements are ignored tests, with no ordinary-CI timing thresholds. The full suite was not run.
Overlap scan: #1575 extends the same sampler to list threads but retains its spin; #2371 and #3913 change FSR presentation only. No existing sampler-pacing/sleep contribution was found.
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.