Date: Tue, 26 Feb 2008 12:02:26 -0800 From: Xin LI <delphij@delphij.net> To: cokane@FreeBSD.org Cc: freebsd-x11@freebsd.org, d@delphij.net Subject: Re: Xorg vs gettimeofday() and clock_gettime() Message-ID: <47C47052.2000205@delphij.net> In-Reply-To: <47C46222.7030607@FreeBSD.org> References: <47C320DB.70004@delphij.net> <18371.11144.568407.26227@gromit.timing.com> <20080226100728.GU83599@server.vk2pj.dyndns.org> <18372.13307.731931.284086@gromit.timing.com> <47C45ABF.7000408@delphij.net> <47C46222.7030607@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Coleman Kane wrote: > Xin LI wrote: >> John E Hein wrote: >>> 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. >> I think it was some delay call, gettimeofday()s is mostly happen when >> there is some animations, in the single Xorg process. >> >> I will try to make a patch this weekend. Last weekend I tried to modify >> only xproto and rebuild dbus and xorg-server, but it seems that it does >> not like it - with mixed gettimeofday() and clock_gettime(), the display >> will blank from time to time. >> >> Cheers, > You'll want to remember that clock_gettime returns timspec.tv_nsec > (nanoseconds), while gettimeofday returns timeval.tv_usec > (microseconds). In order to perform the conversion, you'll want to make > sure you convert nanoseconds to microseconds (*1000). Yes, you're absolutely right, we need to do the conversation, otherwise the precision of the time would be truncated to second as observed by the application, which is not good. Cheers, - -- Xin LI <delphij@delphij.net> http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHxHBSi+vbBBjt66ARAhaCAKCVzFI6KIs1xSKzJJjd88doVbXgWgCfZUI0 cNzqOiKQpc/1iHkZ05Q6qzs= =BSmw -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47C47052.2000205>