Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Nov 1997 05:30:37 -0700 (MST)
From:      Charles Mott <cmott@srv.net>
To:        hackers@hub.freebsd.org
Subject:   Re: gettimeofday() overhead
Message-ID:  <Pine.BSF.3.96.971104052448.29917B-100000@darkstar.home>
In-Reply-To: <199711041024.CAA01699@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 4 Nov 1997, Jeffrey Hsu wrote:
> If you had threads, you could have a thread which calls gettimeofday()
> once a second, storing it into a variable.  This is what Sun's Java
> Web Server does to avoid calling gettimeofday() on each web hit. 
> 
> If you knew where the time was in kernel memory, you could map it
> into your address space and read it.  This is what Digital's X 
> server does to timestamp X events.

For some reason, method number 2 intrigues me.  Maybe because it
is probably the lowest overhead yet the most accurate.

How would one go about doing this?  Is it dependent on the
specific kernel build, or would there be a means of automatically
locating and mapping the kernel time variable?

> You could try setting a timer to go off once a second and update your
> cached time of day variable.
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.971104052448.29917B-100000>