Search code examples
androidaccelerometerpower-management

Measure power consumption related to particular app


As a part of application tests, I need to somehow measure how much my app is draining the battery.

In Android there is a chart in the Battery Setting where I can see the percentage consumption, as well as CPU time or wake time, but problems arise while my app is using accelerometer continuously while running.

The acceleremoter also has the strongest element of standby usage, so I would like to estimate its particular usage, somehow.

Does acceleremoter battery-usage belong to Android System, or Android OS, or neither of them?

How can acceleremoter battery-usage be determined accurately?

Note: I have been thinking about measuring actual consumption using a multi-meter and electrodes attached between the battery and the device's power contacts, but I am scared about breaking my phone.


Solution

  • taken from How to calculate power consumption of android app? :

    Using adb tools you can view power consumption of each running app

    adb shell dumpsys cpuinfo

    sample output

    Load: 1.12 / 1.07 / 1.01 CPU usage from 11344ms to 1613ms ago: 10% 122/system_server: 5.8% user + 4.5% kernel / faults: 989 minor 0% 233/com.htc.android.wallpaper: 0% user + 0% kernel / faults: 910 minor 0.8% 271/com.htc.launcher: 0.8% user + 0% kernel / faults: 832 minor 0% 40/panel_on/0: 0% user + 0% kernel 0% 8/suspend: 0% user + 0% kernel 0% 54/synaptics_wq: 0% user + 0% kernel 0.2% 57/w1_bus_master1: 0% user + 0.2% kernel 0% 253/com.android.phone: 0% user + 0% kernel / faults: 3 minor 0% 13/kondemand/0: 0% user + 0% kernel 0% 56/curcial_wq: 0% user + 0% kernel 0% 2879/com.htc.bg: 0% user + 0% kernel / faults: 8 minor
    0% 2904/dhd_dpc: 0% user + 0% kernel 0% 2906/com.google.android.apps.maps:NetworkLocationService: 0% user + 0% kern

    using

    adb shell dumpsys batteryinfo