Android 如何在插入时测量应用程序功耗 [英] Android How to measure app power consumption when plugged

查看:14
本文介绍了Android 如何在插入时测量应用程序功耗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何测量设备与电脑连接时的应用功耗?

我已经从 Android Studio 中了解了

How to measure app power consumption when I connect my device with my pc?

I've read about batterystats from Android Studio. And I've followed the instructions and get a batterystats dumpsys. However, I can't not let my device consistently plugged on usb port because the result of dumpsys will have a missing part called "Estimated power use". Which is the most important part of the whole test because the app power consumption it contained.

I've tried using StopCharge app to interrupt phone charging. But the prerequisite is that the device need to get ROOT.

Other options like power tutor is outdated. Information out from the application can't quite fit my request(Android 6.0 or upper).

Is it possible to get the power consumption measurement of an application when it's charging or is my mind out of the roof?

Thank you in advance!

p.s the following is a sample of the method of Android Studio batterystats

Estimated power use (mAh)
Capacity: 2930, Computed drain: 43.9, actual drain: 58.6-87.9
Screen: 35.6
Unaccounted: 14.7 ( )
Uid u0a2618: 2.91 ( cpu=2.17 wake=0.657 wifi=0.00656 sensor=0.0732 )

解决方案

I think when you plug, the battery stats are not very accurate. There's two ways i usually do:

  1. Connect the adb by wi-fi and run batterystats

    • In Android Studio go to preferences->Plugins and search for Wi-fi, this way you connect the device on USB, go to plugin and he do the wifi connection

Or if you don't wanna a new plugin

  • Run adb tcpip 5555 and adb connect 192.168.0.101:5555 if you already have usb access (More info.)

-

  1. Use the Google Battery Historian:

    • In this link, download the project following the guidelines
    • In your adb, run adb shell dumpsys batterystats --reset to clear all the history
    • Use your App for some time
    • Go back on ADB an generate the log: adb bugreport > bugreport.txt
    • Then Upload the file to the Battery Historian site that you will host by following the instructions, and you are done.

Image of the Battery Historian:

这篇关于Android 如何在插入时测量应用程序功耗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆