Comment 5 for bug 658957

Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 658957] Re: ubuntu-sso-login responsible for an unreasonable number of CPU wakeups, despite having nothing to do

On Wed, Oct 13, 2010 at 12:43:31PM -0000, Naty Bidart wrote:
> HI Steve, thanks for your answer.

> Can you please detail how can I measure/see this polling you're
> referring to? The service will not shutdown by itself, but is not doing
> any explicit polling either.

If you run 'sudo powertop' in a terminal, this will show the top causes of
system wakeups. On a system that has ubuntu-sso-login running, it shows up
for me with a steady 10.0 wakeups per second. You may want to make your
terminal taller if you have a busy system with lots of other causes of
wakeups; but you'll probably notice that all of the higher causes for
wakeups are either the kernel / hardware, or applications that you're
actively using, not background services that should be idle.

The most likely causes for wakeups (at the C/syscall level) would be some
sort of sleep/usleep call, or a select() with an unreasonably short timeout.
Mapping this to python code is somewhat trickier; as a general rule, it's
important for any application to consolidate as many of its timers as
possible into a single timer, so that it can, say, wake up once a second, do
its work, and put the CPU back to sleep.

I was looking for a good reference to power-efficient desktop programming
since I know such things have been written, especially for GNOME; but I'm
coming up empty at the moment. However, I did find
<https://bugzilla.redhat.com/show_bug.cgi?id=239893>, which describes a
similar "10/sec" wakeup problem with another PyGTK app, so maybe that will
provide some clues here?

BTW, what's the reason for the service not shutting itself down after an
idle timeout? I thought this was fairly standard practice for dbus
services.

Thanks,
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
<email address hidden> <email address hidden>