3

I'm comparing the resource consumption of two Android Apps.

  • App A uses accelerometer

  • App B uses both accelerometer and gyroscope

After reading these sensors, these apps does some processing on the sensor values. Now I measured their CPU usage using dumpsys cpuinfo as well as top command. In general, App B uses 3-4 times more CPU than App A. The actual numbers are as follows: These results for single CPU and my phone is using Dual-core 1.2 GHz Cortex-A9 CPU (Samsung Galaxy S2).

App A (Average CPU Usage: 5%)
APP B (Average CPU Usage = 20%) 

Then I measured the percentage battery usage for these two apps. I kept the Android phone in Aeroplane mode and only one of these two apps were running at a a specific moment of time. After running them for one hour, I get the following results:

Remaining battery level after one hour of use:
Idle mode: 99%  
Running App A: 96%
Running App B: 93%

I was expecting the same ratio with these battery level as I observed with CPU Usage. I also tested these apps on a smartwatch ( CPU: Quad-core 1.2 GHz Cortex-A7) and I observed even smaller difference between the battery use. The observed results for one hour use are as follows:

Remaining battery level after one hour of use:
Idle mode: 99%  
Running App A: 87%
Running App B: 85%

So my question: Why the ratio of CPU usage for these apps is not reflected in their remaining battery levels? Or Shouldn't the CPU Usage be linearly related to the battery use ? Could the reason be that multiple cores are active at the same, that's why I observe small difference between the their battery levels? PS: I use partial lock in these apps.

  • 1
    The CPU frequency may play a role here. Power consumption is not linear to frequency, and frequency scaling depends on the load. If B gathers more data but has to wait for it frequently, the CPU freq scaling may not reach the threshold for acceleration. -- This is of course just a basic consideration of a potential factor which has the potential to lead to what you observe. – Class Stacker Jan 16 '17 at 20:04
  • Okay.. My misunderstanding. I can't help with what you are asking- that's way beyond me. Deleting that answer – beeshyams Jan 19 '17 at 13:00
  • Its fine. I expect that there is some kind of relationship between the reported cpu values from top/dumpsys cpuinfo with the cpu load but I can't find anything on it. Its the only way to explain the cpu usage going down when the cpu load goes up. Lets see how the community members respond. – utengr Jan 19 '17 at 13:02
  • Tell you what. User Mobile Power on this site is from the Qualcomm team who made those apps. You try to seek his help, maybe in a chat? – beeshyams Jan 19 '17 at 13:05
  • I already had a few email conversations with him on his official email :) After all those conversations, I rolled back to using these utilities instead of trepn/app tune kit. I'm just curious about this specific behavior. – utengr Jan 19 '17 at 13:09
1

Long story short, battery comsumption depends not only on CPU but also every other part of your device.

Full version. An SoC consists of CPU, GPU, modem, north bridge, south bridge and RAM (on a discrete semiconductor chip but packed together into the same shell) altogether. Also the battery powers not only the SoC but also sensors, screen (which is usually the most power-consuming part) and wireless connection antennae.
A CPU has its own algorithm to control it's power and performance, which is called a 'governor'. A radical CPU governor tends to provide better CPU performance at the cost of high battery consumption, whereas a gentle governor will try to reduce battery consumption, resulting in lower CPU performance. The same applies to GPU and other parts of the SoC.
The screen is often the most battery-consuming part of a device, and the most decisive factors of a screen's power are size, resolution, brightness and technology (LCD or OLED). Cheaper phones and watches use LCD screens while high-end ones use OLED screen, as OLED uses significantly less power than an LCD one of the same specifications.
A watch usually has significantly less battery capacity but not-so-little screen power, which will decrease the draining difference in its battery stats while the screen is on. Besides, the sensors used on the phone and the watch may not be exactly the same, causing various differences.
The bottom line, the battery cost is determined by all parts of a device rather than only CPU. If another part is draining too much battery, you can't find large differences even though the CPU's power is highly variable.

  • Thanks for the explanation. I kept the screen off in all these measurements because my app acquires the partial lock. I guess the power usage of cpu might contribute little to the overall power consumption so may be that's why I don't see the same differences in battery level. – utengr Jan 20 '17 at 15:11
0

Power-saving features are an important element to understanding power consumption on an Android device. The Android Doze and App Standby documentation describes power-saving features introduced in Android 6 (Marshmallow). While dozing, Android delays application actions and reduces use of network connections to reduce power consumption.

If the device is not in doze mode, it will consume considerably more power than when in doze mode. If you have an application that keeps the device awake when it otherwise would not be, this will cause other applications and communications to consume more power. The amount of power directly consumed by the application can be very small relative to the power consumption over the doze state.

There are also other battery-saving features (standby, for example), but I have not found documentation that is as good as the doze and app standby descriptions. I assume these other features exhibit the same kind of on/off power consumption characteristics.

0

Android battery usage not only depend on CPU status, but also depends on wifi status, sensors, bluetooth etc. Different device may lead to different result. http://androidxref.com/9.0.0_r3/xref/frameworks/base/core/java/com/android/internal/os/BatteryStatsHelper.java FYI

0

. As already explained. Your battery usage depends on multiple factors not only on CPU.

. Secondly, when device is sleeping it drains very low battery whereas if you use wake lock, more battery is drain. . According to documentation it is better to bundle tasks and run them in one go rather than calling wake lock again and again - because after wakelock is released it takes some time for phone to go back to idel state.

. Please check out following documentation

https://developer.android.com/topic/performance/power/

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.