Skip to content

test: wait for fresh ticks in the other profiler tests (GREEN, Fixes #6047) - #6050

Merged
vpacher merged 1 commit into
masterfrom
fix/6047-profiler-tests-fresh-ticks
Dec 1, 2026
Merged

vpacher merged 1 commit into
masterfrom
fix/6047-profiler-tests-fresh-ticks

Conversation

@vpacher

@vpacher vpacher commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Fixes #6047.

Cause. wait_frames() in test_source_profiler, _gpu, _late and _totals waits on tick_event, an auto event that every tick signals. A tick that nobody waited for leaves it set, and the next wait_frames(n) then waits for one tick fewer. #6043 hit this in test_source_profiler_run (fixed there by #6044).

Change. Each of the four helpers calls os_event_reset(tick_event) before its loop, as #6044 does. docs/knowledge/timing-tests.md gets a section on frame waits on an auto event, with how to see a stale wait. Test-only: no libobs change, no assertion changes.

Defensive. The current calls do not get a stale tick: these tests remove their sources between cases and call wait_frames() right after the previous wait. The change keeps a later case from getting the race of #6043.

Evidence (Linux, a throwaway probe that times the first wait of each wait_frames() call; under 1 ms would be a stale tick, about one frame interval is a fresh one):

variant hybrid libobs C reference
master's helpers + probe 4/4 pass; 0 of 15 first waits under 1 ms (33-45 ms each) 4/4 pass; 0 of 15
this change + probe 4/4 pass; 0 of 15 4/4 pass; 1 of 15 (a tick right after the reset)
this change, no probe 4/4 pass 4/4 pass

Counting ticks or rendered frames inside the wait did not show the stale case: the stale tick's frame is still being drawn when the wait returns, so it counts as new. The knowledge note says so.

Test cost: no new tests; each wait_frames() call can take up to one frame more.

🤖 Generated with Claude Code

…6047)

wait_frames() in test_source_profiler, _gpu, _late and _totals waits on
tick_event, an auto event that every tick signals. A tick that nobody
waited for leaves it set, and the next wait_frames(n) then waits for one
tick fewer (#6043). Clear the event before the loop, as #6044 does in
test_source_profiler_run.

Defensive: the current calls do not get a stale tick. A probe that times
the first wait of each call measured about one frame in all 15 calls,
on hybrid libobs and the C reference.

docs/knowledge/timing-tests.md gets the lesson (#6043, #6047).

Test-only: no libobs change, no assertion changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vpacher
vpacher requested a review from zackees as a code owner December 1, 2026 08:10
@vpacher
vpacher enabled auto-merge December 1, 2026 08:11

@zackees zackees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review: LGTM. It applies #6044's os_event_reset(tick_event) before waiting to vpacher's four other profiler tests, which have the same leftover-signal race (#6047). Each adds 5 lines of synchronization with no assertion changed, and the lesson goes into docs/knowledge/timing-tests.md. The Tier 2 Linux build failure was a CI token expiry (HTTP Error 618: jwt:expired), which I've rerun. Auto-merge on.

@vpacher
vpacher added this pull request to the merge queue Dec 1, 2026
Merged via the queue into master with commit a648178 Dec 1, 2026
100 of 102 checks passed
@vpacher
vpacher deleted the fix/6047-profiler-tests-fresh-ticks branch December 1, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

test: the profiler tests' wait_frames() counts a tick from before the call

2 participants