From owner-freebsd-hackers Tue Nov 4 02:24:30 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id CAA01705 for hackers-outgoing; Tue, 4 Nov 1997 02:24:30 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: (from hsu@localhost) by hub.freebsd.org (8.8.7/8.8.7) id CAA01699 for hackers; Tue, 4 Nov 1997 02:24:26 -0800 (PST) (envelope-from hsu) Date: Tue, 4 Nov 1997 02:24:26 -0800 (PST) From: Jeffrey Hsu Message-Id: <199711041024.CAA01699@hub.freebsd.org> To: hackers Subject: Re: gettimeofday() overhead Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Since timing measurements don't have to be >particularly accurate for libalias, does anyone >have an idea how time might be measured >entirely in user space? 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. You could try setting a timer to go off once a second and update your cached time of day variable.