xfmedia: wakeups per second in idle, play time
Brian J. Tarricone
bjt23 at cornell.edu
Thu May 31 20:05:14 CEST 2007
On Thu, 31 May 2007 10:47:27 -0700 Brian J. Tarricone wrote:
>On Thu, 31 May 2007 10:39:41 -0700 Kok, Auke wrote:
>>Then ogg123/mpg123 kick everyones butt, getting down to about 40 wps
>>during songplay. I suspect that even that is really a lot higher than
>>needed, as generally you can buffer more than a second or two before
>>needing to refill it, so technically we should be able to listen to
>>audio with 1wps :)
>I really feel like this is kinda useless here. The media player is
>shoving data at the sound card, and the sound card is probably
>generating interrupts like mad. If you're actually *doing stuff*, what
>do you expect? The CPU has to do work. I think using powertop to
>examine computers that are idle is useful, but not so much when
>applications are actually doing things. Obviously you can use powertop
>to find applications that you'd rather aren't doing things, but a media
>player kinda defeats that. While it's playing, it's *always* doing
Also, they're doing decoding (assuming it's not just PCM read off
disk). While that's being done, the CPU probably isn't even going to
sleep at all. So 'wakeups' is pretty meaningless in this context.
Actually, in this case *more* wakeups could be a *good* thing -- it
could mean that the app is doing decoding in batches and letting the
CPU sleep a little, then waking it and doing some more decoding, etc.
A lower number of wakeups could mean that the app is keeping the CPU
awake most of the time.
Of course, you also have to account for how long the CPU is sleeping.
If you're getting 200 wakeups per second, it means the CPU was asleep
for at least 200 intervals in that second. If those 200 intervals are
each 1ms in length, the CPU is sleeping for 20% of the time. If you're
only getting 10 wakeups per second, but the CPU is only sleeping for
10ms before each of those wakeups, your CPU is actually only sleeping
10% of the time. (Obviously it's a little more complicated when you
take into account the various sleep states and their different levels
of power-saving, but you get the idea.)
In other words: when the machine isn't idle, wakeups-per-second is a
useless metric. Total time per second spent asleep (well, weighted time
depending on how deep the sleep) is the useful measure.
Sure, when the app is actually doing nothing, let's try to minimise the
number of wakeups. I get that, and I'm on board. It's great if the
CPU can take a nap when you're not actually using the conputer. But if
a media player is actually playing something, you're using the
computer. You have to expect the CPU to be awake a decent chunk of the
time, and trying to keep it asleep for as long as possible while it's
trying to do something useful is just a silly micro-optimisation, and
time (my time, at least) could be better spent elsewhere.
More information about the Xfce4-dev