当前位置:网站首页>App performance test: (IV) power
App performance test: (IV) power
2022-06-13 06:16:00 【Ming ruoxiao River】
app Performance testing :( Four ) Electric quantity
The following is an analysis of the electric quantity :
Attention should be paid to , Cell phone through USB Connecting to a computer , The phone will be in a state of charge , It must be ensured that the mobile phone is in a non charged state
Switch the non charging state
command :adb shell dumpsys battery set status 1
among status 1 Non charged ,status 2 Is in charge state
namelySwitch to charging state
command :adb shell dumpsys battery set status 2
Get electricity
command :adb shell dumpsys battery
(UPDATES STOPPED – use ‘reset’ to restart)
AC powered: false
USB powered: false
Wireless powered: false
Max charging current: 0
Max charging voltage: 0
Charge counter: 0
status: 1
health: 2
present: true
level: 30
scale: 100
voltage: 3764
temperature: 200
technology: Li-ion
Monitoring script monitoring app Electricity consumption
python3 Code :#/usr/bin/python #encoding:utf-8 import csv import os import time # The control class class Controller(object): def __init__(self, count): # Define the number of tests self.counter = count # Define an array to collect data self.alldata = [("timestamp", "power")] # Single test process def testprocess(self): # Execute the command to obtain power result = os.popen("adb shell dumpsys battery") # To obtain power level for line in result: if "level" in line: power = line.split(":")[1] # Get the current time currenttime = self.getCurrentTime() # Save the obtained data in the array self.alldata.append((currenttime, power)) # Test process control many times def run(self): # Set the phone to the non charging state os.popen("adb shell dumpsys battery set status 1") while self.counter >0: self.testprocess() self.counter = self.counter - 1 # Every time 5 Collect data once per second time.sleep(5) # Get the current timestamp def getCurrentTime(self): currentTime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) return currentTime # Data storage def SaveDataToCSV(self): csvfile = open('power.csv', mode='w') writer = csv.writer(csvfile) print(self.alldata.__len__()) writer.writerows(self.alldata) csvfile.close() if __name__ == "__main__": controller = Controller(5) controller.run() controller.SaveDataToCSV()
边栏推荐
- Fragment lifecycle
- Super model logo online design and production tool
- 欧姆龙平替国产大货—JY-V640半导体晶元盒读写器
- The title of the WebView page will be displayed in the top navigation bar of the app. How to customize
- Sqlplus connection failure
- DLL bit by bit
- Learning records countless questions (JS)
- 1016 part a+b (15 points)
- 【var const let区别】
- Cmake add -fpic option GCC
猜你喜欢
本地文件秒搜工具 Everything
Echart line chart: when multiple lines have the same name, the legend is still displayed
Echart柱状图:echart实现堆叠柱状图
Explication détaillée du triangle Yang hui
华为开发者认证与DevEco Studio编译器下载
AI实现亲人“复活”|老照片修复|老照片上色,免费APP推荐
Echart折线图:当多条折线图的name一样时也显示不同的颜色
A glimpse of [wechat applet]
Echart line chart: different colors are displayed when the names of multiple line charts are the same
JS convert text to language for playback
随机推荐
Wechat applet: use of global state variables
Uniapp mobile terminal uses canvas to draw background convex arc
Wechat applet jumps to H5 page with parameters
Echart histogram: echart implements stacked histogram
USB debugging assistant 20181018 (v1.3)
USB debugging assistant (20191028)
Experience of redis installation under Linux system (an error is reported at the same time. The struct redis server does not have a member named XXXX)
Echart rectangular tree diagram: simple implementation of rectangular tree diagram
Wechat applet uploads pictures (preview deletion limits the size and number of pictures)
AI realizes "Resurrection" of relatives | old photo repair | old photo coloring, recommended by free app
Printf function
免费录屏软件Captura下载安装
二分查找
【js】var、let、const
Applet pull-up loading data
安全基线检查脚本—— 筑梦之路
Uni app upload file
[turn] explain awk (1)__ Awk Basics_ Options_ Program segment parsing and examples
AI实现亲人“复活”|老照片修复|老照片上色,免费APP推荐
[JS] array flattening