From owner-cvs-src@FreeBSD.ORG Sun Nov 27 13:10:43 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 28BC816A41F; Sun, 27 Nov 2005 13:10:43 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 72B3843D49; Sun, 27 Nov 2005 13:10:42 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout2.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id jARDAd0o027952; Mon, 28 Nov 2005 00:10:39 +1100 Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id jARDAcTb024718; Mon, 28 Nov 2005 00:10:38 +1100 Date: Mon, 28 Nov 2005 00:10:37 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Robert Watson In-Reply-To: <20051127005622.H81764@fledge.watson.org> Message-ID: <20051127234937.X28222@delplex.bde.org> References: <200511270055.jAR0tIkF032480@repoman.freebsd.org> <20051127005622.H81764@fledge.watson.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sys time.h src/sys/kern kern_time.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Nov 2005 13:10:43 -0000 On Sun, 27 Nov 2005, Robert Watson wrote: > ... Attached is a small LD_PRELOAD library to > allow applications to be switched to the _FAST variants for gettimeofday(). % /* % * Small wrapper library to substitute implementations of gettimeofday(2) and % * time(3) with lower resolution variations. time(3) is unconditionally % * degraded, since it will return a truncated time anyway. gettimeofday(3) % * checks the TIMEWRAPPER environmental variable, which can be set to either % * "PRECISE" or "FAST". % */ time(3) should use the environment variable too, since the fast version gives a value that is both imprecise and wrong. It inherits bugs from the kernel's time_second variable. time_second is not the current time truncated, but is the (current time less up to about tc_tick/HZ) truncated. It lags the current time by more than 1 second for up to about tc_tick/HZ seconds before every rollover of the correct truncated time. When HZ was 100 it was very easy for applications to see time_second being wring since the average size of the window of incoherency was 1/200 second. time_second is visible in file times by default for ffs file times. The bug can be fixed for ffs too globally using the vfs.timestamp_precision sysctl. I only use this sysctl for running POSIX tests for this bug, but would be surprised if always using it caused noticeable pessimization. Updates of file timestamps are cached in non-broken file systems, so it is hard for them to occur as often as ones for context switches -- they will usually be limited by physical disk write bandwidth. Bruce