Kick for Android app power consumption assessment

Source: Internet
Author: User


This is just the simplest way to evaluate your app's power consumption, and if you want more detailed or complex methods, you can use some of the more specialized tools, such as Emmagee (Https://github.com/NetEase/Emmagee), This will be very useful.


The first trick: Look at the system settings-battery power consumption ranking.


Unless your app consumes a lot of power, a phone on the hot, battery straight down, otherwise, for most users, you exactly how much power consumption, mainly to see this.


Test your silent power consumption first:

Do not plug in the USB and power, in the case of not charging, keep your app foreground or backstage for a night, can also be based on different business scenarios, test several times, and then in the setup-battery, look at your power consumption rankings, and further click to see the specific cost.


Re-test your operating power consumption:

Step, just, you can take the competitor or industry benchmark to compare, each normal operation for 10 minutes, and then look at the power consumption ranking and specific costs, believe that their app power consumption at what level, should be in the mind.



Second trick: View the power consumption of each component through the ADB tool.


Each component in the phone (CPU, LED, sensor, GPS, 3G, WiFi, Wakelock, and so on) is placed in the Power_profile.xml file, and the system is set up--in the battery-usage case. The usage of energy consumption in statistics is also based on the value of Power_profile.xml as the base parameter. Use the command to monitor the length of the app's components, then calculate the power consumption of the app using a weighted calculation based on the basic parameters of the device's power consumption. The procedure is as follows:


1) unplug the USB connection;

2) operation of the app (for example, to keep the foreground, backstage silence for some time);

3) Plug in the USB, execute adb shell Dumpsys batteryinfo, find your application corresponding UID resource use, as shown below Wake lock gcm_lib:24m 41s 316ms long time use, resulting in power consumption :

#10062:

NETWORK:160.39KB received, 150.69KB sent

Wake Lock window:4s 729ms window (2 times) Realtime

Wake lock gcm_lib:24m 41s 316ms Partial (1 times) Realtime

Wake lock alarmmanager:32ms Partial (times) Realtime

Total wake:24m 41s 348ms partial, 4s 729ms window realtime

Sensor GPS: (not used)

Proc *wakelock*:

cpu:9s 230ms usr + 9s 470ms krn

Proc com.xxxx.xxxx:

Cpu:1s 120ms usr + 770ms KRN

Proc com.xxxx.xxxx::

cpu:33s 140ms usr + 7s 320ms krn

APK com.xxxx.xxxx::

Service com.xxxx.xxxx::

Created for:47m 23s 532ms uptime

Starts:1, Launches:1

Service com.xxxx.xxxx::

Created for:15s 910ms Uptime

Starts:19, launches:19

......

4) Monitor app wake lock type, frequency and time, sensor usage time, network traffic overhead, CPU usage time of each child process;


Third trick: Observing CPU overhead


While keeping the front and back silent, you can watch the CPU overhead of your app-related processes by commanding adb shell top-d 1 |grep YourApp.

When the front desk is silent, when the scroll screen, countdown, etc. are not visible, we expected CPU consumption 0% .

In particular, background silence, once more than 0%, will inevitably continue to power consumption, must be resolved.



A simple 3 trick is enough to give you a ballpark estimate of your app's power consumption, and a general positioning of the problems that exist.


For wireless devices to the point where today, performance is no longer a problem, but the power is still the biggest bottleneck, your app wants to be the user "out" device because of electricity consumption? Try this simple kick.


Kick for Android app power consumption assessment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.