6

I've been keeping an eye on my battery usage on my Android device (HTC One), mostly to see if I can drain it during a full work-day, and I came across the app usage details under the Power settings.

I get a percentage of battery used by the app, the CPU total, the CPU foreground, and keep awake. I'm not sure what they mean, although I can take a guess, but I'm wondering more on how they work.

For instance, I've used the Chrome browser extensively throughout the day (device was on for ~14 hrs, holding around 30% battery life left) and noticed that the battery usage for the app was at 54%. Under use details (see pic below) CPU total was 29m 31s; CPU foreground was 14m 43s; and Keep awake was 30s.

Screenshot
Screenshot (click image for larger variant)

How can these numbers be relatively low when I know I've used Chrome for more than a half-hour and had it as the primary app running for much longer than 15m, which is assuming that my ideas on CPU total and foreground use are what I believe they are.

In essence, what do those three numbers mean in terms of app/battery usage and what does it tell me?

9

The first thing to remember is that when an app runs, it doesn't actually do computation for the whole time it's running: most of the time it's idle, waiting for data to arrive over the network, or while you're looking at it on the screen. Only very badly-written apps and games keep the CPU active the whole time they're running: this runs the battery down very quickly, and makes your phone rather warm.

So even if Chrome has been on the screen for 30 minutes, it shouldn't have used 30 minutes of CPU time. If it's completely static in that time and you're not interacting with it, it might not have used any CPU time at all! But at the other extreme, even if it was continually scrolling a page, it wouldn't use 30 minutes of CPU time: the screen updates every 1/60th of a second, and each time it just has to run for long enough to work out what the next frame should be.

CPU foreground

Bearing this in mind, CPU foreground is how much time the app has been running on the CPU while an activity from the app was in the foreground. (It might also include when a service from the app was in the foreground: that is, displaying an "ongoing" notification.) It's not a very useful figure on its own.

CPU total

I'm sure you already know that apps can run services and broadcast receivers in the background, as well as activities in the foreground. (For more on this, see What's the difference between a service and a broadcast receiver? ) CPU total includes all of this CPU use. If it's a lot more than CPU foreground, you might suspect that the app is doing a lot of work in the background and therefore might be a battery hog. How much is "a lot" depends on the app. An app that keeps running to check some remote service will use more CPU in the background than a sudoku game.

Keep awake

When the screen of your phone is off, it starts to think about having a quick nap. It enters a low-power mode called sleep where the CPU is almost completely powered down until needed. Because this can interrupt apps' background activities, an app can use a wake lock to stop the device going to sleep until it's finished. (There's also another kind of wake lock, which stops the screen turning off automatically. A video player might use that kind of wake lock.) An app can also use an alarm to wake the device up to perform some background tasks.

Keep awake measures the length of time that this app has used wake locks or alarms to keep the device awake when it would otherwise have been asleep. In a way, this is potentially the biggest drain on battery. Sleeping uses much less power than staying awake, so if an app keeps a wake lock for a long time, it's keeping your device in a high-power mode all that time, even if the app isn't doing any useful work.

If you see an app whose Keep awake time is more than a few seconds, you should report a bug to the app developer, and you might consider uninstalling it. 30 seconds over the course of a whole day is reasonable for an app that does work in the background, but most apps will show less than a second here.

3

Following is the explanation to the numbers you have in question.

  • CPU total = Total time of CPU Usage of your app (CPU total = CPU foreground + CPU background) In your case, Chrome browser used the CPU for a total time of 29 minutes and 31 seconds.

  • CPU foreground = CPU usage while the app is in the foreground (visible on screen and focused) In your case, Chrome browser used the CPU for a total time of 14 minutes and 43 seconds when it was visible and focused in the screen

  • Keep awake = The time your app kept the device from sleeping (prevented the phone from turning the screen off)

Additionally, some devices hae the following item as well.

  • CPU background = CPU usage while the app is running in the background (it has a background process, or widget, etc)

So, as you can see, the actual time the app used your CPU is lesser than the time you used the app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.