Xorg vs gettimeofday() and clock_gettime()

John E Hein jhein at timing.com
Tue Feb 26 15:45:18 UTC 2008


Peter Jeremy wrote at 21:07 +1100 on Feb 26, 2008:
 > My guess is pointer acceleration and/or 3-button emulation.  Out of
 > interest, I just ktrace'd my X server for 5 seconds (doing nothing in
 > particular) and got 318 syscalls, including 106 gettimeofday() calls.
 > By waving the mouse around inside a window, I get 4015 syscalls,
 > including 844 gettimeofday() and 1136 sigprocmask() calls in 5
 > secinds.  In some cases, there are consecutive gettimeofday() calls
 > with no other syscalls intervening.  These numbers do seem somewhat
 > excessive.

Interesting.  

I tried a ktrace session for about 10 seconds _without_ moving the
mouse and got 71332 gettimeofday calls out of 142707 total calls and
signals (all SIGALRM - 2051).

After about 7 minutes with mouse movement (and typing this message), I
saw 193356 gettimeofdays vs 502875 total.

I (obviously) haven't looked at the code.  But perhaps this is an area
that could possibly be improved by more judicious use of select or
kqueue and more independence of interval timing.


More information about the freebsd-x11 mailing list