Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / Incredibly high CPU usage...

Author
Message
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 25th May 2012 13:27 Edited at: 25th May 2012 14:51
I believe this has been spoken about a couple times, and think this is quite a problem for android. I have created two apps so far with AppGameKit, the first was with version 1.06x and has no issues, the CPU usage for both my app and the AppGameKit Player are minimal. However, with my newest app, and the 1.07x AppGameKit Player, I am getting around 50% CPU usage.

Whilst the app is actually active this is probably not a huge concern (although surely it shouldn't be this high?), but the biggest problem is that it remains this high when sent to the background.

Does anyone else see this as a problem? Or is this normal?



EDIT: Image was tooooo big...
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 25th May 2012 19:19
hello funnel7:

I know you posted this problem somewhere else.

i did after your previous post to send the AppGameKit player to the background but I didn't have this problem neither my mobile got worm.

Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 25th May 2012 20:16 Edited at: 25th May 2012 20:17
Hello basjak, I've never actually posted about this before, but remembered someone had... I've just found the original thread now...

http://forum.thegamecreators.com/?m=forum_view&t=196999&b=41

So it seems I'm not the only one experiencing this issue... My phone does't actually get warm, it just uses almost 50% CPU even in background, its a strage one as even the AppGameKit Player does it, which was downloaded from Google Play...
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 25th May 2012 23:56
Looks like there is a tight loop running to test for coming out of the background state.

-- Jim
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 26th May 2012 13:33
I have noticed that to, luckily it seems to only be the player doing this and standalone apps usualy idle at 10% or so
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 27th May 2012 19:19
Is there a way of detecting when the app has gone to the background? I know we now have GetResumed(), but that detects when the app has resumed from background. What I'm wondering is if there's a way to detect that a request has been made to send the app to the background, I can then add a line of code to close the app... I'd rather close the app than it sit there taking up 50% CPU... I'm pretty sure this would generate quite a few negative reviews...
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 27th May 2012 21:07
My phone got hot when I had it in my pocket as I went to the store. Previously the player have stopped running completely when sent to the background. So the player was running at 45-50% CPU while in a warm pocket, screen off. That's why it got hot and how I noticed that the player was still running.

I think it should run at less than 1% in background, or at least under 5%. It's good to know that it's only the player that have this problem. But now I don't leave the player on while working, I only turn it on occasionally for testing.

Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 27th May 2012 21:13 Edited at: 27th May 2012 21:14
Digital Awakening, unfortunately, from what I have seen, its not just the player... I have an app behaving exactly the same...

I should be publishing it to Google Play tonight, if I do, would you mind downloading it to see if the same happens for you? It will be Free so won't cost you anything...
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 28th May 2012 17:41
Good news for those that are experiencing this issue... Paul has advised that this has been resolved in version 1075... Gotta love TGC!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 28th May 2012 17:46
As have other issues, but a couple new ones have popped up in 1075 (android accelerometer not quite right).

Cheers,
Ancient Lady
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Aug 2012 19:20
I finally found the cause of the high CPU usage and thought I'd share it before an update so you can make the necessary change if you are compiling the app in eclipse.

In jni/main.c near the bottom is a bit of code that looks like this


If you change it to


It will lower the CPU usage when in the background.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 7th Aug 2012 20:51
Thanks for sharing Paul
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 7th Aug 2012 21:31
That's excellent Paul! I have verified that all is working ok now. The CPU is now down to a healthy 0.33% whilst running in the background!! Thank you!

Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 8th Aug 2012 12:38
Great Will start using Eclipse soon.

Login to post a reply

Server time is: 2024-11-23 14:47:22
Your offset time is: 2024-11-23 14:47:22