From owner-freebsd-current@FreeBSD.ORG Sat Oct 29 01:09:27 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from [127.0.0.1] (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 9A87316A41F; Sat, 29 Oct 2005 01:09:26 +0000 (GMT) (envelope-from davidxu@freebsd.org) Message-ID: <4362CBC2.8050602@freebsd.org> Date: Sat, 29 Oct 2005 09:09:22 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.11) Gecko/20050911 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Robert Watson References: <35696.1130538037@critter.freebsd.dk> <20051029005719.I20147@fledge.watson.org> In-Reply-To: <20051029005719.I20147@fledge.watson.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Pertti Kosunen , Poul-Henning Kamp , current@freebsd.org, "Yuriy N. Shkandybin" Subject: Re: Timers and timing, was: MySQL Performance 6.0rc1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Oct 2005 01:09:27 -0000 Robert Watson wrote: > Another important question is whether using these alternative time > access methods in user space improves the performance of any of the > applications we care about. Hence providing a patch that someone can > try -- while the microbenchmarks seem to show improved performance, > will the applications? I suspect it will in some important cases, but > there's only one way to find out. > > It strikes me that replacing time(3) with something that retrieves > CLOCK_SECOND shouldn't harm time(3) semantics. Likewise, keeping > CLOCK_REALTIME as is is likely OK -- if an application requests it > using clock_gettime(), then it is presumably looking for high > accuracy. It's gettimeofday() that's the troubling one -- it's widely > used to query the time in applications, and its API suggests > microsecond resolution. > > Robert N M Watson > > thread libraries use clock_gettime, this becauses there is pthread_cond_timedwait and other synchronization objects like rwlock, and mutex all have a timeout version, I think pthread_cond_timedwait is mostly used in some applications, though normally, application is not looking for high accuracy. they will get benefit from the clock_gettime speed improvement.