I did a few tests with the patch and did not see any "large" drifts like the
ones observed above.
Thanks for testing.
I think it could be "simplified" by making use of instr_time instead of timespec
for current and absolute. Then I think it would be enough to compare their
ticks.
Correct I attached a v2 of this patch that uses instr_time to check the elapsed
time and break out of the loop. It needs some more benchmarking.
Since sub-millisecond sleep times are not guaranteed as suggested by
the vacuum_cost_delay docs ( see below ), an alternative idea
is to use clock_nanosleep for vacuum delay when it’s available, else
fallback to WaitLatch.
Wouldn't that increase even more the cases where sub-millisecond won't beguaranteed?
Yes, nanosleep is going to provide the most coverage as it’s widely available.
Regards,
Sami