Files
piik/prototype
T
AAA c501215c95 fix(native): meet the SDK's deadlines on Windows without waiting for the system tick
The engine pump slept until the SDK's next deadline with a tokio timer. On
Windows that timer fires on the system tick, 15.6 ms unless a process has
raised it, and Windows 11 does not keep a raised period for a process that is
neither visible nor audible. Measured here: a 2 ms tokio sleep returns about
14 ms late, std::thread::sleep about 0.5 ms late.

The pacer and the bandwidth probes need those deadlines. With the default tick
a Native sender's estimate stayed between 200 and 300 kbit/s for twenty
seconds on loopback, so the allocator rejected the optional flow of the
recovery fixture and its test failed on every run on this machine. With the
deadlines met the same fixture reaches 11.7 Mbit/s in two seconds.

One thread per pump now sleeps on its behalf: an interruptible wait while the
instant is far, then slices of a millisecond on the high-resolution timer that
std::thread::sleep uses since Windows 10 1803. Other platforms keep the tokio
timer. The thread's CPU cost during a session is not measured; it wakes at
most once a millisecond while a deadline is within 32 ms.

All 206 Native tests pass here with the default tick, the recovery test
included.
c501215c95 · 2026-11-26 06:50:52 +08:00
History
..