> > >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. > > 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); >} > > Well, try the following change, things should improve: diff = (1000000 * after.tv_sec + after.tv_usec) - (1000000 * before.tv_sec + before.tv_usec); Rishi. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/