profile: report late and expired profiling windows accurately #316
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!316
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-316"
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?
@battledogegames-design on GitHub · 2026-11-26 19:55 UTC · original
battledogegames-design:patch-1→a-publier· +191 −2 · 1 files · 2 commits · merged 2026-11-26 22:30 UTCFixes #284 (reported by @itsonewi — thank you for the careful write-up).
profile_on_schedulemeasures everyVICTORY_PROFILEwindow against the one start and runs them one after another in a single thread. That scheduling is unchanged by this PR. What changes is that its outcomes are no longer silent:from(an earlier profile ran into it) samples only the rest of its window. It now says so when it begins:the profile in <file> begins late (at X s of F to T s): it covers only the rest of its window.tosampled nothing, but still wrote arounds 0file and printedthe profile is in <file>. It now writes nothing and reports:no profile is in <file>: its window (F to T s) had already passed when its turn came. If a file from an earlier run already exists at that name, it is left byte-for-byte untouched and the message says so (no new profile is in <file>: …; the file there is from an earlier run and was not touched), so stale output cannot be mistaken for this run's.;list that cannot be read as a window was dropped byfilter_mapwithout a word. It is now named once:a profile was not understood and is skipped: <entry>. Empty entries (e.g. from a trailing;) are still ignored.Semantics preserved
from/toremain absolute times from the one start, as documented and asVICTORY_STACKSuses its times. The relative re-measurement floated in #284 (sleepfrom, then sampleto − from) was deliberately not adopted: it would silently change what existing schedules mean.asked()), the output file format, and the success message for windows that actually sample are unchanged.Implementation
One file,
crates/victory-loader/src/profile.rs. The window's standing when its turn comes is judged by a small pure function,turn(from, to, now) -> OnTime | Late | Elapsed; list parsing moves intoschedule(), which returns the unreadable entries alongside the windows so they can be named. No scheduling code is reordered or altered.Tests
Deterministic tests in the module (the module requires
--features diagnostics):a_windows_turn_is_judged_against_the_one_start— pure classification: single window, sequential non-overlapping windows, partial overlap, complete overlap, deadline reached/passed.a_schedule_reads_its_windows_and_names_the_rest— pure parsing: valid windows kept, invalid entries returned for naming, empty input/entries.a_window_that_has_already_passed_writes_no_profile— behavioural regression test: fails before this change (the expired window wrote a file and reported success), passes after.a_window_that_has_already_passed_leaves_an_earlier_file_alone— an earlier run's file at the same name is neither truncated nor overwritten.a_window_that_begins_late_samples_until_its_deadline— control: passes before and after; pins the sampling behaviour the change must not alter.Validation (exact environment — read the caveat)
Executed by the author on Linux (Ubuntu 24.04) with Rust stable, target
x86_64-pc-windows-gnu, the PE test binaries run under Wine 9.0 (MinGW toolchain). This is real execution of the real test binaries, but it is not native Windows validation; a native run remains the final confirmation for the thread-sampling paths.profile::— 2 passed, 1 failed (the expired-window test; output showsthe profile is in …printed for the empty profile). Fullvictory-loadersuite: 55 passed, that test the only failure.profile::— 6 passed. Fullvictory-loadersuite (cargo test -p victory-loader --features diagnostics): 59 passed, 0 failed (two of three runs; see flake note).profile.rs(two pre-existing warnings indescriptor_sites.rs).Known unrelated flake:
publish::tests::concurrent_publishers_do_not_share_a_staging_filefails intermittently under Wine on both the unmodified and patched binaries (filesystem-timing sensitivity); it does not touch this module and the patched suite passed 59/59 in two of three full runs. Flagging it here so it is not mistaken for a regression from this change.No performance claims: this is a profiler-correctness change. Its only runtime cost is a message in cases that previously printed a different one, and an early return that skips writing an empty file.
@battledogegames-design on GitHub · 2026-11-27 00:33 UTC · original
Post-merge native Windows validation of PR #316 at
f865d0bfis complete. The base (cd8dfc06) reproduced both expired-window failures: it created a misleading zero-round profile and overwrote an earlier run's file.The corrected implementation passed all six profiler tests and the complete loader diagnostics suite (59 unit and 3 integration tests). The concurrent-publisher test passed in 50 fresh processes on each revision.
We also verified that
profile.rsis byte-identical at the PR headf865d0bf, merge commit751618c7, and verified upstream tip4eb6cfdf.A separate public-scheduler probe confirmed that overlapping windows retain their original absolute deadline. The second window, scheduled for 300–800 ms, began at 603–609 ms and its last samples fell at 798–799 ms across three runs.
One minor reporting nuance: the otherwise on-time first window printed
begins latein all three runs because lateness is classified after waking from the scheduled sleep. The observed sampling schedule remained correct. This is a diagnostic reporting nuance, not a demonstrated scheduling correctness defect.Validation environment: Native Windows build 26300, Rust 1.98.1 MSVC. Offline full-workspace dependency resolution was blocked by an unavailable
zlib-rspackage in the unrelated game crate. The loader and its two internal dependencies were therefore built in isolation. All 59 retained registry entries matched the original lockfile, and the complete loader diagnostics suite, including its synthetic integration fixture, executed successfully.AI-assisted development: Nyx (Claude, Anthropic). Independent native Windows validation: Astra 6.2 (OpenAI).