Skip to content

fixed, rework logic in SoftAE::ProcessSuspend to not consume CPU, damn vampires. #1991

Closed
wants to merge 1 commit into from

2 participants

@davilla
davilla commented Dec 26, 2012

Excess CPU consumption shows up under amlogic single core arm.

@davilla
davilla commented Dec 26, 2012

Fixes audio issues under Pivos Linux/Android, need desktop win/linux platform verification for Frodo inclusion.

@DDDamian

Was it the order? ;) Does the fix in general allow you to remove the ifdefs around the call to ProcessSuspend added by TheUni as a workaround?

Not sure, I changed the order because m_softSuspend check is faster than the .empty() checks. Since all these are &&'ed together, do the fast ones 1st.

I suspect the added else m_softSuspend = false or the double SystemClockMillis system call, the 1st would happen all the time which is silly. Both only need to happen if we are testing to soft suspend.

And yes, The ifdef removal around the call to ProcessSuspend would be a separate commit.

See here for what pivos is running.
Pivosgroup@80763ee

On a quick test here it never falls into the suspend loop below as curSystemClock never exceeds m_softSuspendTimer - i.e. we never pass the 10-second countdown to drop into the wait state.

Gotta run out but will test more tonight.

quite possible I broke the auto suspend feature :)

@davilla
davilla commented Dec 26, 2012

moving curSystemClock = XbmcThreads::SystemClockMillis(); up to where var is defined is ok. That will keep curSystemClock updating.

@DDDamian

Lol - no wonder it worked better ;) Not sure how I got into this - all my devices have ponies and my OS doesn't mind suspending, so I'm blind on the effects.

But yes, curSystemClock must be updated to fall into the loop after 10 seconds. It seems the code designed to reduce load (the wait) is actually increasing it somehow...

@DDDamian

@davilla - once it drops into the While{..} loop it should only wake every 100msec on Droid or 50msec to check things out (unless a navsound is played to trigger m_wake.Set), so usage should be minimal unless event waits are borked on those platforms.

If the need is to reduce the load in the 10sec until we drop into the event wait I did a test using a yielding Sleep(0) based on the bool hasAudio in SoftAE::Run().

When profiling here in idle and with the event wait active SoftAE was ~5.5% of the load, with the GUI being the main load. Some 10% of the CPU time was in that event wait.

@davilla davilla closed this Feb 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.