Re: gettimeofday() a special case : why?

Jakub Jelinek (jakub@redhat.com)
Mon, 13 Dec 1999 14:49:54 +0100


On Mon, Dec 13, 1999 at 02:31:27PM +0100, Marnix Coppens wrote:
> 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.

Isn't this because truss is lame? gettimeofday on Solaris is a hack, where
it bypasses normal syscall interface and uses ta 0x27 instead.
The normal syscall overhead they have was too high for them so they special
cased gettimeofday including syscall interface for it.

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.26 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

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