From owner-cvs-all@FreeBSD.ORG Thu Mar 6 10:29:24 2008 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2C0A1065671; Thu, 6 Mar 2008 10:29:24 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id A0CD18FC19; Thu, 6 Mar 2008 10:29:24 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 3901546B61; Thu, 6 Mar 2008 05:29:24 -0500 (EST) Date: Thu, 6 Mar 2008 10:29:24 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Peter Jeremy In-Reply-To: <20080306095407.GS68971@server.vk2pj.dyndns.org> Message-ID: <20080306102751.J21309@fledge.watson.org> References: <200803060022.m260MHSx017085@repoman.freebsd.org> <20080306092045.GA54220@freebsd.org> <20080306095407.GS68971@server.vk2pj.dyndns.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@freebsd.org, Roman Divacky , src-committers@freebsd.org, cvs-all@freebsd.org, Jung-uk Kim Subject: Re: cvs commit: src/usr.sbin/moused moused.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Mar 2008 10:29:25 -0000 On Thu, 6 Mar 2008, Peter Jeremy wrote: > On Thu, Mar 06, 2008 at 10:20:45AM +0100, Roman Divacky wrote: >> On Thu, Mar 06, 2008 at 12:22:17AM +0000, Jung-uk Kim wrote: >>> Prefer clock_gettime(2) over gettimeofday(2) and use CLOCK_MONOTONIC_FAST. >>> It is only used to track elapsed time and it does not have to be >>> precise. >> >> what is the rationale behind this? what is the expected improvement? I am >> not questioning the change I am just curious.. > > There's been a recent extensive thread about poor X11 performance and it > turns out the the Xserver can issue multiple gettimeofday(2) calls every > time it sees a mouse movement. gettimeofday(2) on FreeBSD is relatively > expensive (the Project chose accuracy over speed) and clock_gettime(2) using > CLOCK_MONOTONIC_FAST is a much cheaper alternative when accuracy isn't > critical. > > The Xserver should be using clock_gettime(2) but there's a bug in its > POSIX-compatibility selection. Applying a similar fix to moused is a > logical extension. Many applications also assume that gettimeofday(2) returns a monotonically, and possibly consistently, increasing value. Sometimes this is fine (log timestamps) and other times this is not (time deltas used to calculate mouse acceleration, etc). Robert N M Watson Computer Laboratory University of Cambridge