Re: 2 Questions about Linux

Itai Nahshon (nahshon@actcom.co.il)
Tue, 03 Feb 1998 02:07:41 +0200


Perry Harrington wrote:
>
> > do_gettimeofday within the kernel, gettimeofday outside...
> > resolution should be a few microseconds.
>
> Thanks,
> But what is the overhead of doing this? I'd like not to impact the flow of data
> as much as possible (TCP driver). How much CPU can I expect that call to
> chew up?
>
I did not look at that code for ages now...

Things depend on many things...
The pentium and clones have a register which free cycles at a very high
rate. That register can be used to adjust the result of do_gettimeofday
very close to a microsecond accuracy, and that code is very efficient.

Not all cpus (including other X86 cpus and clones) have such a counter.
The counter cannot be used reliably on the pentium if APM is defined.
In these cases the accuracy of do_gettimeofday is not as good and
the overhead may be much higher.

Also, in early 2.0.x kernels or older the function do_gettimeofday
could have close to 1/100 second mistake if called from within an
interrupt
handler (the result was not even monotonic!). I believe that is fixed
in more current kernels.

Itai

-- 
Itai Nahshon   nahshon@actcom.co.il
        Also   nahshon@vnet.ibm.com