Audacious creates 133 wakeups while being idle

Rafał Krypa mail at iceberg.pl
Mon Oct 22 16:13:07 PDT 2007


On Tue, 2007-10-23 at 00:31 +0200, Peter Hüwe wrote:
On Tuesday 23 October 2007 00:13:22 Alan Jenkins wrote:
> > Peter Hüwe wrote:
> > > Hi,
> > >
> > > I noticed that audacious (music player) creates 133 wakeups while
being
> > > in idle mode (i.e. playback stopped)
> > > ->This is quite a huge amount
> > >
> > > Any suggestions how to reduce that amount?
> > > I tried disabling the scrolling song name feature, but that
reduced the
> > > wakeups only by three.
> >
> > If theres an option to increase buffer sizes that might help.
> >
> > I think just keeping an audio device open causes wake-ups on some
> > drivers, even if you're not writing to it.  But it's also possible
your
> > player is writing (silence) to the device.
> >
> > What are the wakeups like when playing?  Much more?  Less?  The
same?
> >
> > It seems to be a common feature of music players, though 133 is
> > excessive.  Amarok does 50/s all the time, idle or playing.  My
guess is
> > these wakeups are probably something most music players do at a low
> > level, and that it's probably more natural to keep the wakeups going
on
> > idle (i.e. it made the code look better and there didn't seem to be
any
> > reason not to do it at the time).  IOW I'd look at the audio output
> > path, not the GUI.
> 
> 
> When Playing the value jumps up to 200 on schedule_timeout and a new
item 
> shows up with 70 wake ups (do_nanosleep)  [+ 50 from the soundcard
driver]
> 
> stracing it shows this:
> http://nopaste.biz/20545
> 
> ls -l /proc/`pgrep audacious`/fd|awk '{print $1 " " $9 " " $10 " "
$11}' 
> 
> lrwx------ 0 -> /dev/pts/2
> lrwx------ 1 -> /dev/pts/2
> lrwx------ 2 -> /dev/pts/2
> lrwx------ 3 -> socket:[73223]
> lr-x------ 4 -> pipe:[73225]
> l-wx------ 5 -> pipe:[13222]
> l-wx------ 6 -> pipe:[73225]
> lr-x------ 7 -> pipe:[13239]
> l-wx------ 8 -> /home/peter/.config/audacious/log
> lrwx------ 9 -> socket:[73231]
> 
> grepping the numbers out of netstat shows en empty result
> 
> 
> 
> Starting audacious headless (i.e. without a GUI) it still creates 100
wakeups
> 
This is unfortunately caused by a design of audacious.
After quick look at the source code I found:

Timeout for GUI:
src/audacious/ui_main.c:2957:
void
> mainwin_attach_idle_func(void)
> {
>     mainwin_timeout_id = g_timeout_add(MAINWIN_UPDATE_INTERVAL,
>                                        mainwin_idle_func, NULL);
> }
> 
MAINWIN_UPDATE_INTERVAL is defined in src/audacious/ui_main.h:

> #define MAINWIN_UPDATE_INTERVAL  10

Timeout for headless:
src/audacious/main.c:1236:
// if we are running headless
>     else
>     {
>         GMainLoop *loop;
> 
>         mainwin_set_info_text();
>         playlist_start_get_info_thread();
> 
>         starting_up = FALSE;
> 
>         loop = g_main_loop_new(NULL, TRUE);
>         g_timeout_add(10, aud_headless_iteration, NULL);
>         g_main_loop_run(loop);
> 
>         return EXIT_SUCCESS;
>     } 
> 
So no matter if you are running with gui or headless, application will
start a 10ms timer for some "main loop" operations.
Getting rid of these wake ups would require moderate changes in the
source, so probably you should notify the author about this issue.





More information about the Power mailing list