Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Feb 2008 12:11:07 -0800
From:      Xin LI <delphij@delphij.net>
To:        freebsd-x11@FreeBSD.org
Subject:   Xorg vs gettimeofday() and clock_gettime()
Message-ID:  <47C320DB.70004@delphij.net>

next in thread | raw e-mail | index | archive | help
-----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@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-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47C320DB.70004>