tests: guest_process_time* fail intermittently under parallel load (sleep returns slightly early on Windows) #3422

Closed
opened 2026-10-11 10:07:09 +00:00 by Zurisen · 0 comments
Zurisen commented 2026-10-11 10:07:09 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-11T10:07:09Z.


The check I added in #3366 / #3368 is too strict. GuestProcessTime.cpp sleeps 50 ms and requires the first sceKernelGetProcessTime/sceKernelGetProcessTimeCounter reading to be at least 50 ms. On Windows, under parallel load, the sleep returns about 0.1-0.15 ms early against the performance counter, so the four guest_process_time* tests fail intermittently on main:

first process time counter does not include the time before the first call

Measured on main e272b92e (Windows 11 Home 26200, WinLibs GCC 15.2.0 r7, Release) with ctest -R "^guest_process_time" -j8 --repeat until-fail:150, printing the values: counter=49896700 ns against 50 ms, first=49852 us against 50 ms, and counter=24934600 ns against 25 ms in the APS5_TIME_SCALE=0.5 variant. They pass alone; one failed in a full ctest -j6 --repeat until-fail:3 run.

Fix branch

Zurisen:fix/process-time-test-margin (one commit on main a4d5d3ce): require half of the sleep. A start captured on the first call still reads about 0, so the test still catches #3366.

  • With the change: the four tests pass 300 times each under -j8 --repeat until-fail:300.
  • Against Time.cpp from before #3368: all four still fail.
  • Conventions check passes.

PR intake is limited, so I have not opened a PR; anyone eligible is welcome to carry the commit.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5800072263 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3422). Originally posted by [Zurisen](https://github.com/Zurisen) on 2026-10-11T10:07:09Z. --- The check I added in #3366 / #3368 is too strict. `GuestProcessTime.cpp` sleeps 50 ms and requires the first `sceKernelGetProcessTime`/`sceKernelGetProcessTimeCounter` reading to be at least 50 ms. On Windows, under parallel load, the sleep returns about 0.1-0.15 ms early against the performance counter, so the four `guest_process_time*` tests fail intermittently on `main`: ``` first process time counter does not include the time before the first call ``` Measured on `main` `e272b92e` (Windows 11 Home 26200, WinLibs GCC 15.2.0 r7, Release) with `ctest -R "^guest_process_time" -j8 --repeat until-fail:150`, printing the values: `counter=49896700 ns` against 50 ms, `first=49852 us` against 50 ms, and `counter=24934600 ns` against 25 ms in the `APS5_TIME_SCALE=0.5` variant. They pass alone; one failed in a full `ctest -j6 --repeat until-fail:3` run. ### Fix branch [`Zurisen:fix/process-time-test-margin`](https://github.com/Zurisen/AnyPS5/commit/e64eef609) (one commit on `main` `a4d5d3ce`): require half of the sleep. A start captured on the first call still reads about 0, so the test still catches #3366. - With the change: the four tests pass 300 times each under `-j8 --repeat until-fail:300`. - Against `Time.cpp` from before #3368: all four still fail. - Conventions check passes. PR intake is limited, so I have not opened a PR; anyone eligible is welcome to carry the commit.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#3422
No description provided.