Suggestions on Avoiding syscall Overhead

Robert Watson rwatson at FreeBSD.org
Sat Apr 28 10:39:25 UTC 2007


On Tue, 24 Apr 2007, Dag-Erling Smørgrav wrote:

> David G Lawrence <dg at dglawrence.com> writes:
>> 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.
>
> gettimeofday(2) returns a value in microseconds, but this does not 
> necessarily mean that it has microsecond precision.  Updating it once per 
> scheduler tick or once per context switch (in userret(), for instance) is 
> probably enough.

We have an overall issue with the cost vs prevision of time measurement in 
FreeBSD.  We err on the side of precision; other systems err on the side of 
cost.  I'm not sure that gettimeofday() is best optimized in the way you 
describe, since if we're going to sacrifice precision, we could sacrifice a 
lot less precision and still get massively better performance.

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the freebsd-current mailing list