profile: VICTORY_PROFILE windows that overlap silently produce empty or truncated profiles #284

Closed
opened 2026-11-26 18:52:44 +00:00 by github-bot · 1 comment
Owner

@⁠itsonewi on GitHub · 2026-11-26 18:51 UTC · original

What happens

crates/victory-loader/src/profile.rs: profile_on_schedule (:63-74) reads from,to,ms,file;… and runs every profile in one thread, one after another, all against the single start taken when the switch was read. Each profile sleeps until its own from (:77, absolute from start) and then samples while start.elapsed() < to (:85).

With VICTORY_PROFILE=0,60,5,a.txt;30,90,5,b.txt — the shape the module documents ("several of them, one after another, with ; between") — the second profile cannot begin before the first ends at 60 s, and its deadline (90 s) is then only 30 s away: it samples half the window it was given. If the first window ends after the second one's to, the second writes a file with rounds 0 and still prints "the profile is in b.txt" (:109), with no warning.

Why it matters

A profiling window that silently covers less (or none) of the time asked for gives a stack file that looks complete and is not — easy to read as "nothing was running then".

Suggested fix

Measure each window from the moment that window starts (sleep from, then while elapsed < to - from), or keep the absolute times but warn when a profile's from had already passed, or its to had already elapsed, when its turn came.

AI use

Found by reading crates/victory-loader/src/profile.rs. No code was built or run.

**@⁠itsonewi** on GitHub · 2026-11-26 18:51 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/284) ## What happens `crates/victory-loader/src/profile.rs`: `profile_on_schedule` (`:63-74`) reads `from,to,ms,file;…` and runs every profile **in one thread, one after another**, all against the single `start` taken when the switch was read. Each profile sleeps until its own `from` (`:77`, absolute from `start`) and then samples `while start.elapsed() < to` (`:85`). With `VICTORY_PROFILE=0,60,5,a.txt;30,90,5,b.txt` — the shape the module documents ("several of them, one after another, with `;` between") — the second profile cannot begin before the first ends at 60 s, and its deadline (90 s) is then only 30 s away: it samples half the window it was given. If the first window ends after the second one's `to`, the second writes a file with `rounds 0` and still prints "the profile is in b.txt" (`:109`), with no warning. ## Why it matters A profiling window that silently covers less (or none) of the time asked for gives a stack file that looks complete and is not — easy to read as "nothing was running then". ## Suggested fix Measure each window from the moment that window starts (sleep `from`, then `while elapsed < to - from`), or keep the absolute times but warn when a profile's `from` had already passed, or its `to` had already elapsed, when its turn came. ## AI use Found by reading `crates/victory-loader/src/profile.rs`. No code was built or run.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:52:44 +00:00
Author
Owner

@⁠lerapeurdu62280-debug on GitHub · 2026-11-26 21:16 UTC · original

Two open PRs fix this: #321 (@⁠Spetrius, +51) and #316 (@⁠battledogegames-design, +191). They conflict with each other in profile.rs, so only one can land. I tested both on a-publier cd8dfc0 (Windows 10 Pro 19045, RX 6600, Rust 1.98.1, --features diagnostics, since the module only exists there):

#321 #316
When it warns at launch, from the schedule (begins computes when each window can start) when each window's turn comes (turn: on time / late / elapsed)
Late window warned, samples the rest warned, samples the rest
Window already over warned, no file warned, no file; an earlier run's file at that name is left untouched and the message says so
Unparsable entries (dropped silently today) not covered named on stderr
Tests 2/2, 3 runs of 3 (pure helper) 6/6, 3 runs of 3 (incl. real profile() calls, ~0.4 s)
Clippy -D warnings (with #330, for a-publier's own lint) clean clean

Both are correct for this issue. #321 is the smaller change and tells you before anything runs. #316 also covers the unparsable entries and the stale file, at the cost of timing-based tests. If you want one: #316 covers more, and #321's up-front warning could be added to it later.

AI-assisted: yes (Claude Code)

**@⁠lerapeurdu62280-debug** on GitHub · 2026-11-26 21:16 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/issues/284#issuecomment-7203557364) Two open PRs fix this: #321 (@⁠Spetrius, +51) and #316 (@⁠battledogegames-design, +191). They conflict with each other in `profile.rs`, so only one can land. I tested both on `a-publier` `cd8dfc0` (Windows 10 Pro 19045, RX 6600, Rust 1.98.1, `--features diagnostics`, since the module only exists there): | | #321 | #316 | |---|---|---| | When it warns | at launch, from the schedule (`begins` computes when each window can start) | when each window's turn comes (`turn`: on time / late / elapsed) | | Late window | warned, samples the rest | warned, samples the rest | | Window already over | warned, no file | warned, no file; an earlier run's file at that name is left untouched and the message says so | | Unparsable entries (dropped silently today) | not covered | named on stderr | | Tests | 2/2, 3 runs of 3 (pure helper) | 6/6, 3 runs of 3 (incl. real `profile()` calls, ~0.4 s) | | Clippy `-D warnings` (with #330, for `a-publier`'s own lint) | clean | clean | Both are correct for this issue. #321 is the smaller change and tells you before anything runs. #316 also covers the unparsable entries and the stale file, at the cost of timing-based tests. If you want one: #316 covers more, and #321's up-front warning could be added to it later. AI-assisted: yes (Claude Code)
This discussion has been locked. Commenting is limited to contributors.
No description provided.