Re: gettimeofday() a special case : why?

Marnix Coppens (maco@telindus.be)
Mon, 13 Dec 1999 14:31:27 +0100


At 13:20 13/12/99 +0100, Artur Skawina wrote:
>salkin@mindspring.com wrote:
>>
>> I don't want to be too OT or bothersome, but can someone explain why
>> gettimeofday() is the one syscall that optimization at the ~100 cycle level
>> makes sense for? If it's a long explanation, a link or pointer to a book is
>
>It's relatively common, used eg for timestamping events, often _every_ event
>(strace a few X apps etc to see some examples).
>It's also special because it does not need to switch domains -- on modern
>cpus the required information is (or can be made) available to the caller,
>hence it's possible to avoid entering the kernel at all. (in general, this
>depends on cpu capabilities, security levels etc)
>

Solaris for instance. If you run truss on an X app, you won't find
gettimeofday().
The man pages also put gettimeofday() in section 3 iso. section 2.
Interestingly enough, time() is still a syscall (section 2) and does show
in truss.
You'd think that time() is a special case of gettimeofday.

Marnix Coppens

---
Reality is that which                   | Artificial Intelligence
when you stop believing                 | stands no chance against
in it doesn't go away. (Philip K. Dick) | Natural Stupidity.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/