X Idle Time reporting is wrong

Adam Batkin adam at batkin.net
Wed Nov 21 14:25:47 UTC 2007


For the past few years I have noticed that my idle times as reported by gaim (err, pidgin) 
have been wrong. So I did some investigation and wrote a small program that calls X's 
XScreenSaverQueryInfo() in a loop once a second and generates some statistics (it's the 
same function called by pidgin). So just to clear one thing up, this problem is definitely 
not with pidgin, it is with the underlying X11 API.

XScreenSaverQueryInfo() fills in an XScreenSaverInfo structure with (among others) field 
"idle" which according to the man page: "specifies the number of milliseconds since the 
last input was received from the user on any of the input devices".

So, here is a summary of my results (plus or minus 1 second) of running the program while 
not touching the computer:
- For 11 minutes, the idle time slowly increases properly
- Then suddenly it drops back down to 0 (or by the function gets called, just a few 
milliseconds)
- The idle time then increases again for 59 minutes
- Then drops back to 0
- The idle time increases for another 23 minutes 18 seconds (weird)
- Then drops to 0
- The idle time climbs normally for a few hours until I bother to start touching the 
computer again

So X became "un-idle" at 11 minutes, 70 minutes (11+59) and approx. 93 minutes (11+59+23)

11 and 59 are special numbers: I specifically set my screensaver to go on at 11 minutes 
and the monitor to power off after 59 (though I have no idea what happens after another 23 
minutes). If I set the screensaver/poweroff times to different numbers, they will be 
reflected in the results of XScreenSaverQueryInfo()

I have tested this with multiple computers, all with different hardware. Here are the 
similarities:
- All are running KDE
- All are running Fedora (though I have had this problem for years, since, say RedHat 7.3 
or 9)
- All have nvidia video cards (though different models)
- All have LCD monitors

All of the systems have had fresh installs over the years and the problem persists.

I haven't done as much testing with Gnome, but I did a quick check and after 60 minutes it 
becomes un-idle, then stays idle (which is weird because I set the screensaver time to 
something like 7 minutes, and monitor poweroff to 57)

Thoughts? Should I try to work with the upstream freedesktop/xorg folks?

-Adam Batkin




More information about the fedora-devel-list mailing list