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
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to