Xorg vs gettimeofday() and clock_gettime()

Xin LI delphij at delphij.net
Mon Feb 25 20:11:17 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear colleagues,

Recently with the respect of some reports about Xorg with jerky mouse
and some "hang"s, I have tried to track down the problem, and it turns
out that the culprit was excessive calls of gettimeofday().

As an fast and easy surgery style hack, I have used Robert Watson's
wrapper library, as available at:
	http://www.watson.org/~robert/freebsd/clock/

In order to work around the fact that Xorg server is setuid and
therefore will ignore the LD_PRELOAD environment, one has to hack
rtld-elf.c at the issetugid() part.  With these changes and set the
wrapper to work using FAST clocks (which are less expensive), you can
see Xorg's CPU consumption will drop sharply, and the hang problems will
go away.

Shall we make some source-level change to Xorg (either upstream under
ifdef FreeBSD or our own port, _FAST clocks are not available on some
other operating systems) so that we can override the gettimeofday()
direct calls and X_GETTIMEOFDAY's to use clock_gettime with a faster clock?

Cheers,
- --
Xin LI <delphij at delphij.net>	http://www.delphij.net/
FreeBSD - The Power to Serve!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFHwyDbi+vbBBjt66ARAl0DAJ4+uu2bMcE8ohB0vW4LgBEedQFSJQCdEQ9G
m1T+XkmxyFwruvzjDZx4znI=
=iWeL
-----END PGP SIGNATURE-----


More information about the freebsd-x11 mailing list