Suggestions on Avoiding syscall Overhead

Robert Watson rwatson at
Tue Apr 24 12:25:07 UTC 2007

On Mon, 23 Apr 2007, David G Lawrence wrote:

>   gettimeofday(2) returns microsecond precision, so I don't see how this 
> could be made accelerated via a mapped global page. time(3) [which is 
> currently a wrapper for gettimeofday(2)], on the other had, could be put 
> into such a page since it only updates once a second.

If we do this, we will need to be careful, perhaps just in documentation, as 
it leads to non-monotonicity if multiple time sources are queried 

On systems with reliable hardware characteristics, such as in Mac OS X, 
precision time querying is supported by providing a kernel-exported estimate 
of the TSC->realtime rate and offset.  This allows zero-system call querying 
of quite accurate time information.  I believe in Mac OS X, this information 
is exported using a shared memory page so that the cost of getting that 
information is also low.

Robert N M Watson
Computer Laboratory
University of Cambridge

More information about the freebsd-current mailing list