当前位置:网站首页>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 2Get 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()
边栏推荐
- Rk3399 hid gadget configuration
- @The detailed explanation of configurationproperties and the problem that all properties of the entity bean modified by this annotation are null after injection are solved
- Hbuilderx: installation of hbuilderx and its common plug-ins
- Free screen recording software captura download and installation
- php redis 制作高迸发秒杀
- Commit specification
- 自定义View
- Essays on November 5, 2021
- MySQL custom function
- Wechat applet (get location)
猜你喜欢

《MATLAB 神经网络43个案例分析》:第11章 连续Hopfield神经网络的优化——旅行商问题优化计算

Echart柱状图:堆叠柱状图value格式化显示
Not in the following list of legal domain names, wechat applet solution

Echart line chart: different colors are displayed when the names of multiple line charts are the same

Wechat applet (get location)

You should consider upgrading via

超有范的 logo 在线设计制作工具

1+1>2,Share Creators可以帮助您实现

Echart line chart: multiple line charts show only one line at a time
不在以下合法域名列表中,微信小程序解决办法
随机推荐
Uni app upload file
智能数字资产管理助力企业决胜后疫情时代
Recommend a capacity expansion tool to completely solve the problem of insufficient disk space in Disk C and other disks
【MySQL】基础知识小复习
Echart柱状图:堆叠柱状图value格式化显示
Using async await in applets
安全基线检查脚本—— 筑梦之路
php redis 制作高迸发秒杀
Security baseline check script - the road to dream
Waterfall flow layout of uni app Homepage
电镀挂具RFID工序管理解决方案
Uniapp hides the scroll bar of scroll view
Wechat applet: use of global state variables
【DP之01背包】
欧姆龙平替国产大货—JY-V640半导体晶元盒读写器
[MySQL] basic knowledge review
Uniapp (upload local pictures, preview pictures, convert Base64 format, upload audio files)
Fusionpbx installation - road to dream
Applet disable native top
The technical analysis of ERP systems of the two camps in the world has been picked up many times.