
android电量测试.pptx
14页电量测试,Android测试,电量,电量公式: 电能(焦耳 J)=电功率P(瓦特W)×时间t(秒s) =电压U(福特V)×电量(库伦) 电功率P(瓦特W)=电压U(福特V)×电流I(安培A) 电量Q(库伦C)=电流I(安培A) ×时间t(秒s),电量实例,如图电池标注3.7V 1200mAh,其中mAh表示电量,电池可以解读为在提供稳定电压3.7V的情况下,可以提供稳定电流1200mA一个小时如果我们在测试的过程中,给提供恒定的电压,那么只需要获取电流值就可以量化的功耗查看电量消耗,在Setting中打开Battery选项,显示电池的使用 情况,查看某一应用的详细功耗分析,通过系统文件获取电量信息,在连接到PC后,在终端使用命令adb shell dumpsys batterystats(4.1-4.3使用命令adb shell dumpsys batteryinfo),打印出详细的耗电信息,一类整机的状态,一类应用的状态 如图将电池的耗电详细信息打印到E盘yankai..txt文件中查看详细信息,查看详细信息,Batterystats collects battery data from your device, and Battery Historian converts that data into an HTML visualization that you can view in your Browser. Batterystats is part of the Android framework, and Battery Historian is open-sourced and available on GitHub at it's good for:Showing you where and how processes are drawing current from the battery.Identifying tasks in your app that could be deferred or even removed to improve battery life.,Battery historian,Prerequisites,A mobile device with Developer Options enabled running Android 5.0 or higher.,Working with Batterystats & Battery Historian,Download the open-source Battery Historion Python script from GitHub ( the file to extract the Battery Historian folder. Inside the folder, find the historian.py file and move it to the Desktop or another writable directory.Connect your mobile device to your computer.On your computer, open a Terminal window.Change to the directory where you've saved historian.py, for example: cd ~/DesktopShut down your running adb server. > adb kill-serverRestart adb and check for connected devices. > adb devices If you don't see any devices, make sure your phone is connected, and USB Debugging is turned on, and then kill and restart adb.,Reset battery data gathering. > adb shell dumpsys batterystats –reset Resetting erases old battery collection data; otherewise, the output will be huge.Disconnect your device from your computer so that you are only drawing current from the device's battery.Play with your app for a short time.Reconnect your phone.Make sure your phone is recognized: > adb devicesDump all battery data. This can take a while: > adb shell dumpsys batterystats > batterystats.txtCreate a HTML version of the data dump for Battery Historian: > python historian.py batterystats.txt > batterystats.htmlOpen the batterystats.htm file in your browser.,,,,。
