perf(libc): add sub-tick spin tail to PreciseSleepUs and PreciseSleepUntil #5827

Merged
hamb3r merged 2 commits from upstream-pr/5827 into main 2026-10-15 18:34:21 +00:00
hamb3r commented 2026-10-14 12:42:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-14T12:42:07Z.


What

  • Windows (_WIN32): Replaces the full-duration SetWaitableTimer + WaitForSingleObject sleep in PreciseSleepHundredNanos and the repeated PreciseSleepUs loop in PreciseSleepUntil with PreciseSleepFromCounterWithTimer.
    • Deadlines (PreciseSleepUntil) and long pacing sleeps (PreciseSleepUs >= 1000 us): Sleep on the thread-local high-resolution waitable timer for duration - 250 us (with a safe fallback to std::this_thread::sleep_for if the timer handle is invalid or SetWaitableTimer / WaitForSingleObject fails) and finish the remaining 250 us sub-tick window using QueryPerformanceCounter + YieldProcessor() (gated to remaining time > 200 ns).
    • Short poll sleeps (PreciseSleepUs < 1000 us): Sleep for the full requested duration on the thread-local high-resolution waitable timer without subtracting a spin tail (allowSpinTail = false), so poll loops (Pm4.cpp WAIT_REG_MEM, Apr.cpp WAIT_MEM, Aio.cpp, AudioOut2Context.cpp, Font/State.cpp) block in the kernel timer rather than busy-spinning a core on Windows (0.84% of a core in a tight PreciseSleepUs(50) x 500 loop).
    • Non-10 MHz QPC frequencies use ceiling conversion (PreciseHundredNanosToQpcTicks) and frequency-scaled pause thresholds (PrecisePauseThresholdTicks) so sleeps never return early on 3.58 MHz / 14.32 MHz / 24 MHz counters.
  • Linux & POSIX (!_WIN32 && !__EMSCRIPTEN__): Replaces the repeated nanosleep loop in PreciseSleepUs and PreciseSleepUntil with PreciseSleepFromNanos using clock_gettime(CLOCK_MONOTONIC). On Linux (__linux__), caches prctl(PR_SET_TIMERSLACK, 1UL, ...) once per thread (thread_local in PreciseLinuxLowTimerSlack()) and sleeps via clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME) up to a 15 us spin tail (100 us conservative fallback if PR_SET_TIMERSLACK is denied by seccomp, and 100 us nanosleep tail on non-Linux POSIX), finishing the final window with _mm_pause() on x86 (std::atomic_signal_fence on non-x86) gated to remaining time > 200 ns.
  • Callers that justify spinning:
    • Linux short command/IO polling (10-200 us): Aio.cpp (10 us), Font/State.cpp (30 us), Pm4.cpp (50 us WAIT_REG_MEM), Apr.cpp (50 us WAIT_MEM), and AudioOut2Context.cpp (200 us FULL_WAIT_STEP). On Linux main, 10-50 us sleeps take 75-118 us due to the default 50 us timer slack + scheduler latency; with the 15 us tail on Linux, 50 us sleeps still block in clock_nanosleep for 35 us and use 7.99 us CPU/call (vs 7.38 us on main, 1.08x). On Windows, short PreciseSleepUs (< 1000 us) remain pure waitable-timer sleeps (~4.05 us CPU/call, 0.84% core in a tight 50 us poll loop).
    • Periodic audio/video pacing (1000-16667 us) & PreciseSleepUntil deadlines: AudioIn (1000 us), AudioOut / Audio3d (5333 us, 187.5 Hz), VideoOutDriver (8341-16667 us), and PreciseSleepUntil callers, where eliminating the per-frame timer overshoot keeps pacing on-target at 0.23% of one core on Linux (vs 0.26% on main) and 1.00% of one core on Windows (53.4 us CPU/frame at 187.5 Hz).

Tested

Linux Per-Call Latency & CPU Cost (x86_64, CLOCK_MONOTONIC + CLOCK_THREAD_CPUTIME_ID, 300 iterations)

Call main (avg / p50 / p99) main CPU/call PR (avg / p50 / p99) PR CPU/call CPU Ratio
PreciseSleepUs(10) (Aio) 78.19 us / 74.61 us / 116.01 us 7.21 us 10.23 us / 10.00 us / 19.90 us 10.24 us 1.42x
PreciseSleepUs(50) (Pm4 / Apr) 117.95 us / 117.11 us / 130.31 us 7.38 us 52.71 us / 50.10 us / 62.81 us 7.99 us 1.08x
PreciseSleepUs(100) (usleep) 169.36 us / 170.31 us / 196.22 us 7.75 us 104.35 us / 104.31 us / 124.31 us 8.40 us 1.08x
PreciseSleepUs(1000) (AudioIn) 1071.21 us / 1071.49 us / 1089.79 us 8.61 us 1005.17 us / 1003.99 us / 1020.79 us 8.47 us 0.98x
PreciseSleepUs(5333) (AudioOut) 5421.69 us / 5408.46 us / 5475.36 us 11.81 us 5346.72 us / 5344.85 us / 5382.66 us 13.64 us 1.15x

Windows Per-Call Latency & CPU Cost (x86_64, QueryPerformanceCounter + QueryThreadCycleTime)

Call main (avg / p50 / p99) main CPU/call PR (avg / p50 / p99) PR CPU/call Mode
PreciseSleepUs(50) (Pm4 / Apr) 552.07 us / 516.90 us / 1011.40 us 3.86 us 523.92 us / 516.50 us / 1008.40 us 4.05 us Waitable timer (< 1000 us)
PreciseSleepUs(100) (usleep) 564.98 us / 515.80 us / 1019.30 us 3.63 us 519.04 us / 515.30 us / 594.50 us 4.08 us Waitable timer (< 1000 us)
PreciseSleepUs(200) (AudioOut2) 544.06 us / 516.40 us / 1041.10 us 4.00 us 518.47 us / 514.70 us / 578.40 us 3.95 us Waitable timer (< 1000 us)
PreciseSleepUs(1000) (AudioIn) 1550.13 us / 1523.00 us / 2055.90 us 3.40 us 1018.00 us / 1000.20 us / 1438.60 us 24.59-63.15 us Hybrid (250 us tail)
PreciseSleepUntil(+50 us) 552.07 us / 516.90 us / 1011.40 us 3.86 us 51.10 us / 50.00 us / 97.70 us 49.10 us Deadline (250 us tail)

Representative High-Frequency Callers (Total Wall Time & Total CPU Usage)

Workload Platform main (Wall / Frame p50 / Total CPU / % Core) PR (Wall / Frame p50 / Total CPU / % Core)
AudioOut 187.5 Hz pacing (200 frames x 5333.3 us = 1066.7 ms) Linux 1066.75 ms / 5333.15 us / 2.81 ms (0.26% core) 1066.68 ms / 5332.77 us / 2.45 ms (0.23% core)
AudioOut 187.5 Hz pacing (200 frames x 5333.3 us = 1066.7 ms) Windows 1066.94 ms / 5373.60 us / 0.93 ms (0.09% core) 1066.84 ms / 5333.00 us / 10.69 ms (1.00% core)
Tight loop PreciseSleepUs(50) x 500 calls Linux 59.32 ms (118.6 us/iter) / 3.65 ms (7.31 us/call, 6.16% core) 25.71 ms (51.4 us/iter) / 4.02 ms (8.04 us/call, 15.64% core)
Tight loop PreciseSleepUs(50) x 500 calls Windows 256.80 ms (513.6 us/iter) / 1.93 ms (3.86 us/call, 0.75% core) 251.62 ms (503.2 us/iter) / 2.11 ms (4.22 us/call, 0.84% core)

Unit & CTest Verification

  • Updated core/libs/tests/PreciseWait.cpp to use a 65-sample median (CheckMedianSleepBound, up to 3 windows) with a busy-runner preemption guard (IsRunnerPreempted + APS5_SKIP_TIMING_TESTS opt-out) so loaded CI runners do not flake:
    • Asserts PreciseSleepUntil(+50 us) < 90 us median on all platforms and PreciseSleepUs(50) < 90 us median on non-Windows.
    • Also verifies PreciseSleepUs(1500), ceiling QPC tick conversion (PreciseHundredNanosToQpcTicks) across 3.58-24 MHz, sub-microsecond and millisecond deadlines, invalid waitable timer handle fallback on Windows, and conservative 100 us tail fallback on Linux.
  • Verified on Windows, Arch Linux, and Ubuntu (-Wall -Wextra -Werror).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4858032755 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5827). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-14T12:42:07Z. --- ### What - **Windows (`_WIN32`):** Replaces the full-duration `SetWaitableTimer` + `WaitForSingleObject` sleep in `PreciseSleepHundredNanos` and the repeated `PreciseSleepUs` loop in `PreciseSleepUntil` with `PreciseSleepFromCounterWithTimer`. - **Deadlines (`PreciseSleepUntil`) and long pacing sleeps (`PreciseSleepUs` `>= 1000 us`):** Sleep on the thread-local high-resolution waitable timer for `duration - 250 us` (with a safe fallback to `std::this_thread::sleep_for` if the timer handle is invalid or `SetWaitableTimer` / `WaitForSingleObject` fails) and finish the remaining `250 us` sub-tick window using `QueryPerformanceCounter` + `YieldProcessor()` (gated to remaining time `> 200 ns`). - **Short poll sleeps (`PreciseSleepUs` `< 1000 us`):** Sleep for the full requested duration on the thread-local high-resolution waitable timer without subtracting a spin tail (`allowSpinTail = false`), so poll loops (`Pm4.cpp` `WAIT_REG_MEM`, `Apr.cpp` `WAIT_MEM`, `Aio.cpp`, `AudioOut2Context.cpp`, `Font/State.cpp`) block in the kernel timer rather than busy-spinning a core on Windows (`0.84%` of a core in a tight `PreciseSleepUs(50)` x `500` loop). - Non-`10 MHz` QPC frequencies use ceiling conversion (`PreciseHundredNanosToQpcTicks`) and frequency-scaled pause thresholds (`PrecisePauseThresholdTicks`) so sleeps never return early on `3.58 MHz` / `14.32 MHz` / `24 MHz` counters. - **Linux & POSIX (`!_WIN32 && !__EMSCRIPTEN__`):** Replaces the repeated `nanosleep` loop in `PreciseSleepUs` and `PreciseSleepUntil` with `PreciseSleepFromNanos` using `clock_gettime(CLOCK_MONOTONIC)`. On Linux (`__linux__`), caches `prctl(PR_SET_TIMERSLACK, 1UL, ...)` once per thread (`thread_local` in `PreciseLinuxLowTimerSlack()`) and sleeps via `clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME)` up to a **`15 us`** spin tail (`100 us` conservative fallback if `PR_SET_TIMERSLACK` is denied by `seccomp`, and `100 us` `nanosleep` tail on non-Linux POSIX), finishing the final window with `_mm_pause()` on x86 (`std::atomic_signal_fence` on non-x86) gated to remaining time `> 200 ns`. - **Callers that justify spinning:** - **Linux short command/IO polling (`10-200 us`):** `Aio.cpp` (`10 us`), `Font/State.cpp` (`30 us`), `Pm4.cpp` (`50 us` `WAIT_REG_MEM`), `Apr.cpp` (`50 us` `WAIT_MEM`), and `AudioOut2Context.cpp` (`200 us` `FULL_WAIT_STEP`). On Linux `main`, `10-50 us` sleeps take `75-118 us` due to the default `50 us` timer slack + scheduler latency; with the `15 us` tail on Linux, `50 us` sleeps still block in `clock_nanosleep` for `35 us` and use `7.99 us` CPU/call (vs `7.38 us` on `main`, `1.08x`). On Windows, short `PreciseSleepUs` (`< 1000 us`) remain pure waitable-timer sleeps (`~4.05 us` CPU/call, `0.84%` core in a tight `50 us` poll loop). - **Periodic audio/video pacing (`1000-16667 us`) & `PreciseSleepUntil` deadlines:** `AudioIn` (`1000 us`), `AudioOut` / `Audio3d` (`5333 us`, `187.5 Hz`), `VideoOutDriver` (`8341-16667 us`), and `PreciseSleepUntil` callers, where eliminating the per-frame timer overshoot keeps pacing on-target at `0.23%` of one core on Linux (vs `0.26%` on `main`) and `1.00%` of one core on Windows (`53.4 us` CPU/frame at `187.5 Hz`). ### Tested #### Linux Per-Call Latency & CPU Cost (`x86_64`, `CLOCK_MONOTONIC` + `CLOCK_THREAD_CPUTIME_ID`, 300 iterations) | Call | `main` (avg / p50 / p99) | `main` CPU/call | PR (avg / p50 / p99) | PR CPU/call | CPU Ratio | |---|---|---|---|---|---| | `PreciseSleepUs(10)` (`Aio`) | `78.19 us` / `74.61 us` / `116.01 us` | `7.21 us` | `10.23 us` / `10.00 us` / `19.90 us` | `10.24 us` | `1.42x` | | `PreciseSleepUs(50)` (`Pm4` / `Apr`) | `117.95 us` / `117.11 us` / `130.31 us` | `7.38 us` | `52.71 us` / `50.10 us` / `62.81 us` | `7.99 us` | **`1.08x`** | | `PreciseSleepUs(100)` (`usleep`) | `169.36 us` / `170.31 us` / `196.22 us` | `7.75 us` | `104.35 us` / `104.31 us` / `124.31 us` | `8.40 us` | **`1.08x`** | | `PreciseSleepUs(1000)` (`AudioIn`) | `1071.21 us` / `1071.49 us` / `1089.79 us` | `8.61 us` | `1005.17 us` / `1003.99 us` / `1020.79 us` | `8.47 us` | **`0.98x`** | | `PreciseSleepUs(5333)` (`AudioOut`) | `5421.69 us` / `5408.46 us` / `5475.36 us` | `11.81 us` | `5346.72 us` / `5344.85 us` / `5382.66 us` | `13.64 us` | `1.15x` | #### Windows Per-Call Latency & CPU Cost (`x86_64`, `QueryPerformanceCounter` + `QueryThreadCycleTime`) | Call | `main` (avg / p50 / p99) | `main` CPU/call | PR (avg / p50 / p99) | PR CPU/call | Mode | |---|---|---|---|---|---| | `PreciseSleepUs(50)` (`Pm4` / `Apr`) | `552.07 us` / `516.90 us` / `1011.40 us` | `3.86 us` | `523.92 us` / `516.50 us` / `1008.40 us` | **`4.05 us`** | Waitable timer (`< 1000 us`) | | `PreciseSleepUs(100)` (`usleep`) | `564.98 us` / `515.80 us` / `1019.30 us` | `3.63 us` | `519.04 us` / `515.30 us` / `594.50 us` | **`4.08 us`** | Waitable timer (`< 1000 us`) | | `PreciseSleepUs(200)` (`AudioOut2`) | `544.06 us` / `516.40 us` / `1041.10 us` | `4.00 us` | `518.47 us` / `514.70 us` / `578.40 us` | **`3.95 us`** | Waitable timer (`< 1000 us`) | | `PreciseSleepUs(1000)` (`AudioIn`) | `1550.13 us` / `1523.00 us` / `2055.90 us` | `3.40 us` | `1018.00 us` / `1000.20 us` / `1438.60 us` | `24.59-63.15 us` | Hybrid (`250 us` tail) | | `PreciseSleepUntil(+50 us)` | `552.07 us` / `516.90 us` / `1011.40 us` | `3.86 us` | `51.10 us` / `50.00 us` / `97.70 us` | `49.10 us` | Deadline (`250 us` tail) | #### Representative High-Frequency Callers (Total Wall Time & Total CPU Usage) | Workload | Platform | `main` (Wall / Frame p50 / Total CPU / `% Core`) | PR (Wall / Frame p50 / Total CPU / `% Core`) | |---|---|---|---| | `AudioOut` `187.5 Hz` pacing (`200` frames x `5333.3 us` = `1066.7 ms`) | Linux | `1066.75 ms` / `5333.15 us` / `2.81 ms` (**`0.26%` core**) | `1066.68 ms` / `5332.77 us` / `2.45 ms` (**`0.23%` core**) | | `AudioOut` `187.5 Hz` pacing (`200` frames x `5333.3 us` = `1066.7 ms`) | Windows | `1066.94 ms` / `5373.60 us` / `0.93 ms` (**`0.09%` core**) | `1066.84 ms` / `5333.00 us` / `10.69 ms` (**`1.00%` core**) | | Tight loop `PreciseSleepUs(50)` x `500` calls | Linux | `59.32 ms` (`118.6 us`/iter) / `3.65 ms` (`7.31 us`/call, `6.16%` core) | `25.71 ms` (`51.4 us`/iter) / `4.02 ms` (`8.04 us`/call, `15.64%` core) | | Tight loop `PreciseSleepUs(50)` x `500` calls | Windows | `256.80 ms` (`513.6 us`/iter) / `1.93 ms` (`3.86 us`/call, **`0.75%` core**) | `251.62 ms` (`503.2 us`/iter) / `2.11 ms` (`4.22 us`/call, **`0.84%` core**) | #### Unit & CTest Verification - Updated `core/libs/tests/PreciseWait.cpp` to use a 65-sample median (`CheckMedianSleepBound`, up to 3 windows) with a busy-runner preemption guard (`IsRunnerPreempted` + `APS5_SKIP_TIMING_TESTS` opt-out) so loaded CI runners do not flake: - Asserts `PreciseSleepUntil(+50 us)` `< 90 us` median on all platforms and `PreciseSleepUs(50)` `< 90 us` median on non-Windows. - Also verifies `PreciseSleepUs(1500)`, ceiling QPC tick conversion (`PreciseHundredNanosToQpcTicks`) across `3.58-24 MHz`, sub-microsecond and millisecond deadlines, invalid waitable timer handle fallback on Windows, and conservative `100 us` tail fallback on Linux. - Verified on Windows, Arch Linux, and Ubuntu (`-Wall -Wextra -Werror`). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
hamb3r commented 2026-10-14 12:53:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-14T12:53:56Z.


сс @adriadam10 @oneandonlydean

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6168805618 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5827#issuecomment-6168805618). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-14T12:53:56Z. --- сс @adriadam10 @oneandonlydean
adriadam10 commented 2026-10-14 13:54:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T13:54:32Z.

Review: CHANGES_REQUESTED


Thanks for the measurements; I reproduced the latency gain on Linux (main vs PR, 300 iterations): PreciseSleepUs(10) 74.8 → 15.0 µs, (100) 163 → 111 µs, (1000) 1081 → 1007 µs. Build and ctest are green. Points to address:

  • CPU cost is not shown to be acceptable. CLOCK_THREAD_CPUTIME_ID per call goes from ~8 µs to ~50 µs for sleeps of 50 µs-1 ms (6x), because every such sleep now ends in a ~50 µs busy spin (550 µs on Windows). Please measure a representative high-frequency caller (a thread looping sceKernelUsleep(50), or AudioOut pacing) before/after in total CPU use, and say which callers justify spinning.
  • The test pins nothing new. core/libs/tests/PreciseWait.cpp:27-49 only asserts that a sleep never returns early, which main already satisfies; it passes without the change. Add an assertion that fails on main, e.g. a median over N iterations of PreciseSleepUs(50) staying within a bound of the target that main exceeds on Linux (use a generous bound and the median so it is not flaky on loaded CI).
  • Timer slack handling (PreciseWait.hpp, PreciseSleepOsNanosWithSlack): two to three extra prctl syscalls per sleep on the hot path. Cache the thread's slack once (thread_local) instead of get/set/restore each call, or justify the cost with a measurement.
  • Windows numbers can't be reproduced here; the Windows CI job should cover precise_wait once dispatched.

Happy to re-review once these are addressed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5519051471 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5827#pullrequestreview-5519051471). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T13:54:32Z. **Review:** CHANGES_REQUESTED --- Thanks for the measurements; I reproduced the latency gain on Linux (main vs PR, 300 iterations): `PreciseSleepUs(10)` 74.8 → 15.0 µs, `(100)` 163 → 111 µs, `(1000)` 1081 → 1007 µs. Build and ctest are green. Points to address: - **CPU cost is not shown to be acceptable.** `CLOCK_THREAD_CPUTIME_ID` per call goes from ~8 µs to ~50 µs for sleeps of 50 µs-1 ms (6x), because every such sleep now ends in a ~50 µs busy spin (550 µs on Windows). Please measure a representative high-frequency caller (a thread looping `sceKernelUsleep(50)`, or AudioOut pacing) before/after in total CPU use, and say which callers justify spinning. - **The test pins nothing new.** `core/libs/tests/PreciseWait.cpp:27-49` only asserts that a sleep never returns early, which `main` already satisfies; it passes without the change. Add an assertion that fails on `main`, e.g. a median over N iterations of `PreciseSleepUs(50)` staying within a bound of the target that `main` exceeds on Linux (use a generous bound and the median so it is not flaky on loaded CI). - **Timer slack handling (`PreciseWait.hpp`, `PreciseSleepOsNanosWithSlack`):** two to three extra `prctl` syscalls per sleep on the hot path. Cache the thread's slack once (thread_local) instead of get/set/restore each call, or justify the cost with a measurement. - Windows numbers can't be reproduced here; the Windows CI job should cover `precise_wait` once dispatched. Happy to re-review once these are addressed.
hamb3r commented 2026-10-14 14:59:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-14T14:59:50Z.


@adriadam10 Thanks for the review! Addressed all three points:

  1. Cached PR_SET_TIMERSLACK once per thread (thread_local): PreciseLinuxLowTimerSlack() now runs prctl once per thread (0 prctl syscalls on the hot path) while still falling back to the 100 us tail if prctl fails.
  2. Reduced spin tail (15 us on Linux, 250 us on Windows) & measured CPU cost:
    • With 1 ns timer slack on Linux, kernel wake-up latency is ~15 us, so shrinking the Linux spin tail from 50 us to 15 us allows 50 us sleeps to block in clock_nanosleep for 35 us. Per-call CLOCK_THREAD_CPUTIME_ID for 50 us - 1 ms drops back to ~8.0-8.5 us/call (1.08x vs main's 7.4-8.6 us/call).
    • On Windows, shrinking kSpinTailHundredNanos from 550 us to 250 us still covers all sub-tick polling callers (Aio 10 us, Font 30 us, Pm4/Apr 50 us, AudioOut2 200 us) while cutting CPU cost on 1000 us (AudioIn) from 429 us to 24.6 us/call and on AudioOut (187.5 Hz) from 4.02% to 1.00% of one core.
Workload Platform main (Wall / p50 / CPU) PR (Wall / p50 / CPU)
PreciseSleepUs(50) (Pm4 / Apr) Linux 117.95 us avg / 117.11 us p50 / 7.38 us CPU 52.71 us avg / 50.10 us p50 / 7.99 us CPU (1.08x)
PreciseSleepUs(100) (usleep) Linux 169.36 us avg / 170.31 us p50 / 7.75 us CPU 104.35 us avg / 104.31 us p50 / 8.40 us CPU (1.08x)
PreciseSleepUs(1000) (AudioIn) Linux 1071.21 us avg / 1071.49 us p50 / 8.61 us CPU 1005.17 us avg / 1003.99 us p50 / 8.47 us CPU (0.98x)
AudioOut 187.5 Hz (200 frames, 1066.7 ms) Linux 1066.75 ms / 5333.15 us p50 / 2.81 ms CPU (0.26% core) 1066.68 ms / 5332.77 us p50 / 2.45 ms CPU (0.23% core)
AudioOut 187.5 Hz (200 frames, 1066.7 ms) Windows 1066.94 ms / 5373.60 us p50 / 0.93 ms CPU (0.09% core) 1066.84 ms / 5333.00 us p50 / 10.69 ms CPU (1.00% core)
Tight loop PreciseSleepUs(50) x 500 (25.0 ms target) Linux 59.32 ms wall (118.6 us/iter) / 3.65 ms CPU (7.31 us/call) 25.71 ms wall (51.4 us/iter) / 4.02 ms CPU (8.04 us/call)
  1. Added upper-bound median assertion in core/libs/tests/PreciseWait.cpp: asserts that the median of 31 PreciseSleepUs(50) calls is < 90 us (fails on main at 117.5 us on Linux and 518.0 us on Windows; passes at ~50.1 us with this PR).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6171357900 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5827#issuecomment-6171357900). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-14T14:59:50Z. --- @adriadam10 Thanks for the review! Addressed all three points: 1. **Cached `PR_SET_TIMERSLACK` once per thread (`thread_local`):** `PreciseLinuxLowTimerSlack()` now runs `prctl` once per thread (`0` `prctl` syscalls on the hot path) while still falling back to the `100 us` tail if `prctl` fails. 2. **Reduced spin tail (`15 us` on Linux, `250 us` on Windows) & measured CPU cost:** - With `1 ns` timer slack on Linux, kernel wake-up latency is `~15 us`, so shrinking the Linux spin tail from `50 us` to `15 us` allows `50 us` sleeps to block in `clock_nanosleep` for `35 us`. Per-call `CLOCK_THREAD_CPUTIME_ID` for `50 us - 1 ms` drops back to **`~8.0-8.5 us/call` (`1.08x` vs `main`'s `7.4-8.6 us/call`)**. - On Windows, shrinking `kSpinTailHundredNanos` from `550 us` to `250 us` still covers all sub-tick polling callers (`Aio` `10 us`, `Font` `30 us`, `Pm4`/`Apr` `50 us`, `AudioOut2` `200 us`) while cutting CPU cost on `1000 us` (`AudioIn`) from `429 us` to `24.6 us/call` and on `AudioOut` (`187.5 Hz`) from `4.02%` to **`1.00%` of one core**. | Workload | Platform | `main` (Wall / p50 / CPU) | PR (Wall / p50 / CPU) | |---|---|---|---| | `PreciseSleepUs(50)` (`Pm4` / `Apr`) | Linux | `117.95 us` avg / `117.11 us` p50 / `7.38 us` CPU | `52.71 us` avg / `50.10 us` p50 / **`7.99 us` CPU (`1.08x`)** | | `PreciseSleepUs(100)` (`usleep`) | Linux | `169.36 us` avg / `170.31 us` p50 / `7.75 us` CPU | `104.35 us` avg / `104.31 us` p50 / **`8.40 us` CPU (`1.08x`)** | | `PreciseSleepUs(1000)` (`AudioIn`) | Linux | `1071.21 us` avg / `1071.49 us` p50 / `8.61 us` CPU | `1005.17 us` avg / `1003.99 us` p50 / **`8.47 us` CPU (`0.98x`)** | | `AudioOut` `187.5 Hz` (`200` frames, `1066.7 ms`) | Linux | `1066.75 ms` / `5333.15 us` p50 / `2.81 ms` CPU (**`0.26%` core**) | `1066.68 ms` / `5332.77 us` p50 / **`2.45 ms` CPU (`0.23%` core)** | | `AudioOut` `187.5 Hz` (`200` frames, `1066.7 ms`) | Windows | `1066.94 ms` / `5373.60 us` p50 / `0.93 ms` CPU (`0.09%` core) | `1066.84 ms` / `5333.00 us` p50 / **`10.69 ms` CPU (`1.00%` core)** | | Tight loop `PreciseSleepUs(50)` x `500` (`25.0 ms` target) | Linux | `59.32 ms` wall (`118.6 us`/iter) / `3.65 ms` CPU (`7.31 us`/call) | `25.71 ms` wall (`51.4 us`/iter) / **`4.02 ms` CPU (`8.04 us`/call)** | 3. **Added upper-bound median assertion in `core/libs/tests/PreciseWait.cpp`:** asserts that the median of 31 `PreciseSleepUs(50)` calls is `< 90 us` (fails on `main` at `117.5 us` on Linux and `518.0 us` on Windows; passes at `~50.1 us` with this PR).
CnRJay commented 2026-10-14 19:16:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-14T19:16:49Z.

Review: COMMENTED


The Linux half now looks right: 1 ns slack, a 15 µs tail and about 8 µs of CPU per call.

The Windows half has a cost the per-call tables don't show. With a 250 µs tail, any PreciseSleepUs of 250 µs or less never reaches the waitable timer, so it is a pure busy-wait. The Windows table confirms it: 49 µs of CPU for a 50 µs sleep, and 200 µs for 200 µs. Those calls are not one-shot sleeps, though. They are poll loops that repeat until something else happens, so on Windows the CPU cost is the whole wait, not the sleep length:

  • Pm4.cpp:1006, WAIT_REG_MEM / 0x93: the queue thread polls a value written "by the CPU or another queue". A wait on a guest CPU write can last a large part of a frame. On main that is about two wakeups per millisecond; with this change the thread spins for the entire wait.
  • Apr.cpp:655 (WAIT_MEM), Aio.cpp:276/301 (completion polls), AudioOut2Context.cpp:341 (FULL_WAIT_STEP loop), Font/State.cpp:60: the same shape.

Each of these loops now holds a core for as long as it waits. This emulator is usually CPU-bound: queue 0 at 95–99 %, eight shader-prepare threads at about 90 % in recent summary lines. A spinning poller takes a core from exactly the threads that would produce the value it waits for, so the shorter poll latency can come back as longer waits elsewhere. On laptops it also costs package power and boost clocks. The "tight loop PreciseSleepUs(50) x 500" row has no Windows entry; by the per-call numbers it would be close to 100 % of a core, against a few percent on main.

The pacing callers are where a spin tail pays off: VideoOutDriver (16.7 ms), AudioOut / Audio3d (5.3 ms) and the PreciseSleepUntil deadlines. There, 250 µs of spinning is a small share of each period and removes the overshoot. Two changes would keep that gain without the polling cost:

  • Only spin toward a deadline, so in PreciseSleepUntil and the long pacing sleeps. Keep PreciseSleepUs as a pure timer sleep for the poll loops, or give it the tail only when the request is well above the timer tick, as on Linux.
  • For the poll loops, the real fix for a slow wake-up is to be woken rather than to poll faster: WaitOnAddress on the label, or the queue's existing completion signal for WAIT_REG_MEM. That's a separate PR per caller. Spinning shouldn't stand in for it.

To show the change is safe on Windows, measure total process CPU and the frame time (aps5-summary.jsonl) for one title before and after, together with the per-call numbers. Pick a title whose queues hit WAIT_REG_MEM or that uses AudioOut2.

The new median test (< 90 µs over 31 calls) is a wall-clock bound, so it will be sensitive to a loaded CI runner and to lavapipe jobs running in parallel. If it stays, a larger sample and an opt-out on a busy runner would avoid intermittent failures that have nothing to do with the change.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5523370155 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5827#pullrequestreview-5523370155). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-14T19:16:49Z. **Review:** COMMENTED --- The Linux half now looks right: 1 ns slack, a 15 µs tail and about 8 µs of CPU per call. The Windows half has a cost the per-call tables don't show. With a 250 µs tail, any `PreciseSleepUs` of 250 µs or less never reaches the waitable timer, so it is a pure busy-wait. The Windows table confirms it: 49 µs of CPU for a 50 µs sleep, and 200 µs for 200 µs. Those calls are not one-shot sleeps, though. They are poll loops that repeat until something else happens, so on Windows the CPU cost is the whole wait, not the sleep length: - `Pm4.cpp:1006`, `WAIT_REG_MEM` / `0x93`: the queue thread polls a value written "by the CPU or another queue". A wait on a guest CPU write can last a large part of a frame. On `main` that is about two wakeups per millisecond; with this change the thread spins for the entire wait. - `Apr.cpp:655` (`WAIT_MEM`), `Aio.cpp:276/301` (completion polls), `AudioOut2Context.cpp:341` (`FULL_WAIT_STEP` loop), `Font/State.cpp:60`: the same shape. Each of these loops now holds a core for as long as it waits. This emulator is usually CPU-bound: queue 0 at 95–99 %, eight shader-prepare threads at about 90 % in recent summary lines. A spinning poller takes a core from exactly the threads that would produce the value it waits for, so the shorter poll latency can come back as longer waits elsewhere. On laptops it also costs package power and boost clocks. The "tight loop `PreciseSleepUs(50)` x 500" row has no Windows entry; by the per-call numbers it would be close to 100 % of a core, against a few percent on `main`. The pacing callers are where a spin tail pays off: `VideoOutDriver` (16.7 ms), `AudioOut` / `Audio3d` (5.3 ms) and the `PreciseSleepUntil` deadlines. There, 250 µs of spinning is a small share of each period and removes the overshoot. Two changes would keep that gain without the polling cost: - Only spin toward a deadline, so in `PreciseSleepUntil` and the long pacing sleeps. Keep `PreciseSleepUs` as a pure timer sleep for the poll loops, or give it the tail only when the request is well above the timer tick, as on Linux. - For the poll loops, the real fix for a slow wake-up is to be woken rather than to poll faster: `WaitOnAddress` on the label, or the queue's existing completion signal for `WAIT_REG_MEM`. That's a separate PR per caller. Spinning shouldn't stand in for it. To show the change is safe on Windows, measure total process CPU and the frame time (`aps5-summary.jsonl`) for one title before and after, together with the per-call numbers. Pick a title whose queues hit `WAIT_REG_MEM` or that uses AudioOut2. The new median test (`< 90 µs` over 31 calls) is a wall-clock bound, so it will be sensitive to a loaded CI runner and to lavapipe jobs running in parallel. If it stays, a larger sample and an opt-out on a busy runner would avoid intermittent failures that have nothing to do with the change.
hamb3r commented 2026-10-14 20:53:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-14T20:53:32Z.


Thanks for the review @CnRJay — addressed in ea690728c:

  1. Windows short poll loops (PreciseSleepUs < 1000 µs):

    • Kept the Linux path unchanged (1 ns cached slack + 15 µs tail).
    • On Windows, PreciseSleepUntil deadlines and long pacing sleeps (PreciseSleepUs >= 1000 µs, i.e. kMinTimerSpinSleepHundredNanos = 10000, well above the 500 µs high-resolution waitable timer tick) use the hybrid waitable timer + 250 µs spin tail.
    • Short PreciseSleepUs calls (< 1000 µs, covering Pm4.cpp WAIT_REG_MEM, Apr.cpp WAIT_MEM, Aio.cpp, AudioOut2Context.cpp, and Font/State.cpp) now pass allowSpinTail = false and sleep for the full duration on the waitable timer without spinning.
    • Added the Windows entry for the tight PreciseSleepUs(50) x 500 loop to the PR description: 251.62 ms wall (503.2 µs/iter), 2.11 ms total CPU (4.22 µs/call, 0.84% of a core), matching main (3.86 µs/call, 0.75% of a core) while keeping PreciseSleepUs(1000+) and PreciseSleepUntil on-target.
  2. Median wall-clock test on loaded CI runners (core/libs/tests/PreciseWait.cpp):

    • Increased the sample size from 31 to 65 calls (up to 3 sample windows in CheckMedianSleepBound) and added a busy-runner opt-out (IsRunnerPreempted() scheduler-gap check + APS5_SKIP_TIMING_TESTS env opt-out) so parallel lavapipe / loaded CI jobs won't cause spurious failures.

cc @adriadam10

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6178232024 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5827#issuecomment-6178232024). Originally posted by [hamb3r](https://github.com/hamb3r) on 2026-10-14T20:53:32Z. --- Thanks for the review @CnRJay — addressed in `ea690728c`: 1. **Windows short poll loops (`PreciseSleepUs` `< 1000 µs`):** - Kept the Linux path unchanged (`1 ns` cached slack + `15 µs` tail). - On Windows, `PreciseSleepUntil` deadlines and long pacing sleeps (`PreciseSleepUs` `>= 1000 µs`, i.e. `kMinTimerSpinSleepHundredNanos = 10000`, well above the `500 µs` high-resolution waitable timer tick) use the hybrid waitable timer + `250 µs` spin tail. - Short `PreciseSleepUs` calls (`< 1000 µs`, covering `Pm4.cpp` `WAIT_REG_MEM`, `Apr.cpp` `WAIT_MEM`, `Aio.cpp`, `AudioOut2Context.cpp`, and `Font/State.cpp`) now pass `allowSpinTail = false` and sleep for the full duration on the waitable timer without spinning. - Added the Windows entry for the tight `PreciseSleepUs(50)` x `500` loop to the PR description: **`251.62 ms` wall (`503.2 µs`/iter), `2.11 ms` total CPU (`4.22 µs`/call, `0.84%` of a core)**, matching `main` (`3.86 µs`/call, `0.75%` of a core) while keeping `PreciseSleepUs(1000+)` and `PreciseSleepUntil` on-target. 2. **Median wall-clock test on loaded CI runners (`core/libs/tests/PreciseWait.cpp`):** - Increased the sample size from `31` to **`65` calls** (up to 3 sample windows in `CheckMedianSleepBound`) and added a busy-runner opt-out (`IsRunnerPreempted()` scheduler-gap check + `APS5_SKIP_TIMING_TESTS` env opt-out) so parallel `lavapipe` / loaded CI jobs won't cause spurious failures. cc @adriadam10
simonbronk commented 2026-10-15 07:40:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T07:40:41Z.


Independent Windows validation of ea690728c32a4c6014932bca09cf971ae3d5b60d (AI-assisted), compared with the PR base 84b01f9cd042e1d2e9e112f8783aa5a9d26399ee.

Windows 11 build 22631, Intel Core i7-8700, WinLibs GCC 15.2.0 r7 UCRT, QPC 10 MHz. Exact PreciseWait.hpp, HostThreadLocal.hpp and PR PreciseWait.cpp extracted from those commits. Standalone builds use -std=c++20 -O3 -DNDEBUG -Wall -Wextra -Werror -static -pthread.

The unmodified PR test passes 3/3 runs (0.141–0.156 s); APS5_SKIP_TIMING_TESTS is absent in the child processes, and stdout/stderr are empty (no busy-runner skip reported). This exercises the existing tick-conversion, deadline, no-early-return and invalid-timer fallback checks.

An independent harness then compares both versions in three interleaved pairs (base/fixed, fixed/base, base/fixed), using normal scheduling. Each execution includes 250 short sleeps, 128 sleeps each at 1000/1500 us, 250 short deadlines, and 200 absolute deadlines at 187.5 Hz. No early return in 5,736 calls across both versions.

The table reports the median of the three per-execution medians; cycles are QueryThreadCycleTime deltas per call, including harness overhead, not CPU-time microseconds or a core percentage.

Workload Base / PR p50 wall time (us) Base / PR thread cycles per call
SleepUs(50) 568.6 / 564.2 34,299 / 32,459
SleepUs(1000) 1110.1 / 1056.7 37,412 / 71,364
SleepUs(1500) 1994.7 / 1574.0 43,883 / 65,810
SleepUntil(+50us) 577.7 / 50.0 36,335 / 160,159
Absolute pacing at 187.5 Hz 5353.9 / 5333.6 47,740 / 145,478

For the 200-deadline pacing loop, total time is 1066.978 / 1066.784 ms (1066.667 ms requested). Median lateness relative to the absolute deadline is 351.9 / 90.0 us; median of per-run p99 lateness is 827.9 / 494.4 us. Individual trials vary with scheduling; these are local synthetic results.

This corroborates that the current Windows short polling path stays timer-based, while deadline/long pacing precision improves at a higher CPU-cycle cost. It does not establish acceptable whole-game CPU use or address the requested title/frame-time validation in the earlier review.

Limits: standalone native header/test execution only; no full AnyPS5/library build, CMake/CTest, title, audio playback, GPU, Linux/macOS, or current-main composition. Non-10-MHz frequencies are checked arithmetically by the PR test, not exercised as real host counters. No global timer-resolution, scheduling, power or security settings changed; no upstream source edits.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6187069707 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5827#issuecomment-6187069707). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-15T07:40:41Z. --- Independent Windows validation of `ea690728c32a4c6014932bca09cf971ae3d5b60d` (AI-assisted), compared with the PR base `84b01f9cd042e1d2e9e112f8783aa5a9d26399ee`. Windows 11 build 22631, Intel Core i7-8700, WinLibs GCC 15.2.0 r7 UCRT, QPC 10 MHz. Exact `PreciseWait.hpp`, `HostThreadLocal.hpp` and PR `PreciseWait.cpp` extracted from those commits. Standalone builds use `-std=c++20 -O3 -DNDEBUG -Wall -Wextra -Werror -static -pthread`. The unmodified PR test passes **3/3 runs** (0.141–0.156 s); `APS5_SKIP_TIMING_TESTS` is absent in the child processes, and stdout/stderr are empty (no busy-runner skip reported). This exercises the existing tick-conversion, deadline, no-early-return and invalid-timer fallback checks. An independent harness then compares both versions in three interleaved pairs (base/fixed, fixed/base, base/fixed), using normal scheduling. Each execution includes 250 short sleeps, 128 sleeps each at 1000/1500 us, 250 short deadlines, and 200 absolute deadlines at 187.5 Hz. **No early return in 5,736 calls** across both versions. The table reports the median of the three per-execution medians; cycles are `QueryThreadCycleTime` deltas per call, including harness overhead, not CPU-time microseconds or a core percentage. | Workload | Base / PR p50 wall time (us) | Base / PR thread cycles per call | |---|---:|---:| | SleepUs(50) | 568.6 / 564.2 | 34,299 / 32,459 | | SleepUs(1000) | 1110.1 / 1056.7 | 37,412 / 71,364 | | SleepUs(1500) | 1994.7 / 1574.0 | 43,883 / 65,810 | | SleepUntil(+50us) | 577.7 / 50.0 | 36,335 / 160,159 | | Absolute pacing at 187.5 Hz | 5353.9 / 5333.6 | 47,740 / 145,478 | For the 200-deadline pacing loop, total time is 1066.978 / 1066.784 ms (1066.667 ms requested). Median lateness relative to the absolute deadline is 351.9 / 90.0 us; median of per-run p99 lateness is 827.9 / 494.4 us. Individual trials vary with scheduling; these are local synthetic results. This corroborates that the current Windows short polling path stays timer-based, while deadline/long pacing precision improves at a higher CPU-cycle cost. It **does not establish acceptable whole-game CPU use or address the requested title/frame-time validation** in the earlier review. Limits: standalone native header/test execution only; no full AnyPS5/library build, CMake/CTest, title, audio playback, GPU, Linux/macOS, or current-main composition. Non-10-MHz frequencies are checked arithmetically by the PR test, not exercised as real host counters. No global timer-resolution, scheduling, power or security settings changed; no upstream source edits.
github-actions[bot] commented 2026-10-15 12:10:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:10:00Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6044 core/libs/tests/PreciseWait.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191711126 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5827#issuecomment-6191711126). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:10:00Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/PreciseWait.cpp` |
adriadam10 commented 2026-10-15 13:17:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T13:17:31Z.

Review: APPROVED


Re-checked ea690728c against the three points of the previous review:

  • CPU cost: measured per call and for the 187.5 Hz pacing loop (Linux ~1.08x per call, 0.23% vs 0.26% of a core); Windows short polls (< 1000 us) are back on the plain waitable timer, and the spin tail only applies to deadlines and long pacing sleeps.
  • Timer slack is cached once per thread, no prctl on the hot path.
  • PreciseWait.cpp now asserts a median bound that main exceeds (PreciseSleepUs(50) ~118 us on Linux vs the 90 us bound).

Build and ctest are green here (105/105, precise_wait passed), and the independent Windows run by @simonbronk matches the claimed PreciseSleepUntil gain. Merging once the Windows build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5533711339 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5827#pullrequestreview-5533711339). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T13:17:31Z. **Review:** APPROVED --- Re-checked `ea690728c` against the three points of the previous review: - CPU cost: measured per call and for the 187.5 Hz pacing loop (Linux ~1.08x per call, 0.23% vs 0.26% of a core); Windows short polls (`< 1000 us`) are back on the plain waitable timer, and the spin tail only applies to deadlines and long pacing sleeps. - Timer slack is cached once per thread, no `prctl` on the hot path. - `PreciseWait.cpp` now asserts a median bound that `main` exceeds (`PreciseSleepUs(50)` ~118 us on Linux vs the 90 us bound). Build and ctest are green here (105/105, `precise_wait` passed), and the independent Windows run by @simonbronk matches the claimed `PreciseSleepUntil` gain. Merging once the Windows build is green.
CnRJay commented 2026-10-15 18:20:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-15T18:20:53Z.


Thanks, that resolves it. The short polls on Windows are back on the plain waitable timer, the tight-loop Windows row matches main, and the spin tail now only serves deadlines and pacing, where it pays off. Nothing more from me.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6199202571 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5827#issuecomment-6199202571). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-15T18:20:53Z. --- Thanks, that resolves it. The short polls on Windows are back on the plain waitable timer, the tight-loop Windows row matches `main`, and the spin tail now only serves deadlines and pacing, where it pays off. Nothing more from me.
Sign in to join this conversation.
No reviewers
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!5827
No description provided.