Open 4ad opened 10 years ago
Here are some sample numbers for the observed delay of usleep(1) % uname -a Linux lucky 3.11.0-19-generic #33-Ubuntu SMP Tue Mar 11 18:48:34 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux % cc time.c && ./a.out usleep(1) took 72298 ns panda(~) % uname -a Linux panda 3.7.10-x13 #1 SMP Wed Jun 26 07:33:15 UTC 2013 armv7l GNU/Linux panda(~) % cc time.c && ./a.out usleep(1) took 122070 ns In both cases these represent the best results I have seen, during some runs I have seen the arm numbers spike to 150us and the amd64 numbers spike to 140us
Attachments:
> runtime·usleep(1) and runtime·usleep(100) are really intended to be more > like scheduler yields, rather than sleeps if the system can't handle them, > it can just do scheduler yield Indeed, replacing sleeps with yields solves the problem: http://paste.ubuntu.com/7234785/
CL https://golang.org/cl/87290043 mentions this issue.