Re: dependability of gettimeofday()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 17 Jul 2002, Karthik M wrote:

> 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.
>
> ----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.

IMHO "Scheduling granularity" is the key here. The linux system on x86
architectures has a heartbeat of 100Hz = 10ms. What this means is that
the system tries to complete its range of tasks such as scheduling
various subsystems, checking on blocked I/O, sending & receiving packets
etc etc. every 10ms. Since some tasks have more priority over others,
they might cause a delay for these low priority tasks which are
generally user processes.

Trying this on an Alpha which has HZ=1000 (IIRC) will give you better
results.

You can improve the granularity of the system by using real-time
versions which give some kind of guarantees. An example is a real-time
patch developed at our university called KURT (www.ittc.ku.edu/kurt/).  
Just enable UTIME to get better granularity.  But even then it might not
be perfect. To get a perfect schedule you would have to use the KURT
scheduler.

Or if you donot want to be bothered with it, just try changing HZ to
1000 in /include/asm/param.h. This *might* give you better results.

Warning: This value might not be suitable for a typical desktop, we
usually use it only on servers.

ciao,
Amit
-- 
I'm an angel!!! Honest!
The horns are just there to hold the halo up straight.
^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
                  Amit Kucheria
          EECS Grad. Research Assistant
         University of Kansas @ Lawrence
   (R): +1-785-830-8521 ||| (C): +1-785-760-2871
____________________________________________________

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux