Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird CPU usage problem when app is backgrounded

Tags:

ios

iphone

I'm experiencing a very weird CPU usage bug with my audio streaming app.

When the app is in the foreground and playing music, the total device CPU usage is only about 15%. However, as soon as the app is put in the background, the CPU usage spikes to 100% and stays there.

About 40% of this is coming from the app process itself, and roughly the other 60% is coming from the SpringBoard process, which apparently handles all Core Animation calls (though I'm not explicitly using Core Animation, I assume that it also handles other UI related activity). Also, according to the "CPU Activity" instrument, most of the additional CPU usage from the app process itself falls into the "graphics" category, though I do see an increase in both the "audio processing" and (strangely) the "foreground app activity" category.

How can I figure out what is causing this problem? Instruments is telling me at high level what is happening, but not why it's happening.

like image 642
Ben Baron Avatar asked Aug 12 '11 00:08

Ben Baron


People also ask

Why is my CPU usage suddenly so high?

You can expect high CPU utilization when playing some games, running a video-editing or streaming application, performing an antivirus scan, or juggling many browser tabs.

Why is my CPU usage at 100 %?

If the CPU usage is around 100%, this means that your computer is trying to do more work than it has the capacity for. This is usually OK, but it means that programs may slow down a little. Computers tend to use close to 100% of the CPU when they are doing computationally-intensive things like running games.

What is normal CPU usage while gaming?

How Much CPU Usage Is Normal for Gaming? 10-30% CPU usage is normal for most games. However, larger games usually require significantly more power, ranging from 30 to 70%. Also, your graphic settings increase the processing power required, so running games on lower settings can help reduce usage and temperature.

Why is my CPU usage so low?

Another factor is the software. If you're not running the latest version of Windows or if you have a lot of programs running in the background, that can also lead to low CPU usage. Finally, it could be your settings. If you're not running the game at the highest possible settings, that can also lead to lower CPU usage.


1 Answers

That's extremely odd. However, without any code, it makes it really hard to say anything about anything. Purely based on speculation, I'd say you're updating the UI without knowing it in the background. Perhaps an animation call on -(void)applicationDidEnterBackground? Give us some more to work with! I'm really curious about this now :)

like image 109
Dylan Gattey Avatar answered Sep 24 '22 03:09

Dylan Gattey