hi everyone, as a follow up to the previous posting regarding effects of measurment, I was testing gettimeofday(). The results that i got out of my test program were not consistent and were varying. Wanted to get an opinion abt it. My test program: ----snip---- #include<stdio.h> #include<stdlib.h> #include<sys/time.h> #include<sys/resource.h> #include<errno.h> extern int errno; int main(int argc, char *argv[]) { int loop_value = atoi(argv[1]); int i=0; long int diff=0; struct timeval before,after; gettimeofday(&before,NULL); for (i = 0; i < loop_value; i++); gettimeofday(&after,NULL); diff = 1000000 * (after.tv_sec - before.tv_sec); diff += after.tv_usec - before.tv_usec; fprintf(stderr,"the value of diff : %ld \n\n", diff); } ----snip---- The results that i got with the above test program are : ----snip---- [root]# date Wed Jul 17 23:42:50 EDT 2002 [root]# [root]# ./try 10000000 the value of diff : 302839 [root]# ./try 10000000 the value of diff : 209972 [root]# ./try 10000000 the value of diff : 230121 [root]# ./try 10000000 the value of diff : 214455 [root]# ./try 10000000 the value of diff : 266560 [root]# ./try 10000000 the value of diff : 260128 [root]# ./try 10000000 the value of diff : 213221 [root]# ./try 10000000 the value of diff : 252402 [root]# ./try 10000000 the value of diff : 249561 [root]# ./try 10000000 the value of diff : 244444 [root]# ./try 10000000 the value of diff : 211876 [root]# ./try 10000000 the value of diff : 296651 [root]# ./try 10000000 the value of diff : 233641 [root]# ./try 10000000 the value of diff : 234075 [root]# date Wed Jul 17 23:43:18 EDT 2002 [root]# ----snip----- the values are varying a lot and did'nt have a clue why it was the case. Did a little search on google but could'nt find an answer. TIA Karthik __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/