Mobile/Powersaving/Wakeups/Debugging

< Mobile‎ | Powersaving‎ | Wakeups
Revision as of 00:06, 27 May 2010 by Azakai (talk | contribs) (Created page with '= Overview = 'Wakeups' are instances where a thread enters activity. Each such wakeup stops the CPU from sleeping. Several short wakeups are much worse than a single long wakeup…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Overview

'Wakeups' are instances where a thread enters activity. Each such wakeup stops the CPU from sleeping. Several short wakeups are much worse than a single long wakeup, because each wakeup will prevent sleeping for a short time afterwards, and sleeping can save a lot of power (see powertop docs). So avoiding wakeups is important, and if they are unavoidable then 'clumping' them together is preferable to scattering them at semi-random times.

Finding Wakeups

One approach to finding wakeups is to add some debug prints to the relevant NSPR functions, which are PR_WaitCondVar (in nsprpub/pr/src/pthreads) and so forth, e.g.

PR_IMPLEMENT(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout)
{
   printf("PR_WaitCondVar %x ; %d\n", cvar, timeout);

This can give you some useful information when running. To further detect what code is calling the function, consider running the debugger and placing breakpoints there, then looking at a stack trace.