[uae] Re: CPU usage

  • From: Richard Drummond <evilrich@xxxxxxxxxxxxxx>
  • To: uae@xxxxxxxxxxxxx
  • Date: Fri, 25 May 2007 10:41:23 -0400

On Friday 25 May 2007 09:34:03 Richard Drummond wrote:
> I need to check the source code, but my guess is that when sound output is
> disabled, E-UAE is being prevented from sleeping fully by lots of bogus
> interrupt/signals/whatever from the underlying sound system (ALSA, for
> example). E-UAE isn't actually disabling sound output properly - it's just
> not sending any audio data the sound system - and so the sound system keeps
> screaming "Gimme some data, you b*st*rd!".

Okay. I was totatlly wrong there. The reverse is actually true.

When audio output is enabled, synchronization with the sound system 
necessarily means that E-UAE sleeps more than it would do than if audio 
output were off. When it's on, the main E-UAE thread sleeps due to the 
STOP-handler _and_ it sleeps when the audio system is blocking and not ready 
for more data. When audio output is off, it only sleeps due to the former.

Not really sure how to tackle this at the moment. One way to redress the 
balance would be to farm the audio output code (i.e. the bit that punts data 
to the sound system and thus performs the synchronization with the sound 
system) off to a separate thread, but then you hit the problem that we saw 
with the SDL audio driver: the audio thread can't interrupt the main E-UAE 
thread quickly enough, and you get stuttery audio output.

I'll have a think about it.

For now, if you've got audio output off, you'll probably need to increase the 
CPU idle rate setting in E-UAE to get E-UAE to stop hogging the CPU so much.

Cheers,
Rich
-- 
Richard Drummond

Web:  http://www.rcdrummond.net/
Mail: mailto:evilrich@xxxxxxxxxxxxxx

Other related posts: