Skip to content

Instantly share code, notes, and snippets.

@martani
Created July 26, 2011 17:49
Show Gist options
  • Save martani/1107347 to your computer and use it in GitHub Desktop.
Save martani/1107347 to your computer and use it in GitHub Desktop.
nanosleep(), usleep() and sleep() benchmark
$ ./time
Call to nsleep(970000) took 970149
Call to usleep(970000) took 970143
Call to sleep(1) took 1000154
$ ./time
Call to nsleep(970000) took 970105
Call to usleep(970000) took 970169
Call to sleep(1) took 1000142
$ ./time
Call to nsleep(970000) took 970150
Call to usleep(970000) took 970077
Call to sleep(1) took 1000129
$ ./time
Call to nsleep(970000) took 970136
Call to usleep(970000) took 970092
Call to sleep(1) took 1000183
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment