01-18-2009, 05:03 AM
Code:
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
int main() {
struct timeval t0,t1;
int usec;
gettimeofday(&t0,NULL);
usleep(250);
gettimeofday(&t1,NULL);
usec = t1.tv_usec - t0.tv_usec + 1000000*(t1.tv_sec - t0.tv_sec);
printf("usecs: %d\n",usec);
}
On my system (HZ=100 and dynticks) I get values slightly above 250 (e.g. 258) usecs, which proves that usleep does not depend on HZ - if you configure your kernel correctly.
Can someone test my howto on wiki.fragaholics.de if it works with HZ=100 and dynticks? It could make thinks a little better, because you have fewer interrupts...
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!