1.查看当前运行软件的包名和类名:
adb shell "dumpsys window | grep mCurrentFocus"
2.进入adb shell:
adb shell
3.查看CPU占用率:
top | grep 包名(只查看指定包名的CPU占用率)
或
top -m 10 -s cpu(-m 显示最大数量,-s按指定排序)
使用时要把CPU换成9,因为会报 top: not integer: cpu
adb shell top -s命令只支持0-X数字,默认9,猜测分别指代
0 , 1 ,3 , 4, 5 , 6 , 7 ,8, 9 , 10 , 11 , 12
PID,USER,PR,NI,VIRT,RES,SHR,S,%CPU,%MEM,TIME+,CMDLINE
top -m 10 -s 9(-m 显示最大数量,-s按指定排序)
User 46%, System 40%, IOW 0%, IRQ 0% //CPU占用率
User 84 + Nice 1 + Sys 75 + Idle 24 + IOW 0 + IRQ 0 + SIRQ 0 = 184 // CPU使用情况
4.查看内存占用率:
dumpsys meminfo | grep 包名
5.查看耗电量:
dumpsys battery
AC powered:false 是否连接AC(电源)充电线
USB powered:true 是否连接USB(PC或笔记本USB插口)充电
Wireless powered:false 是否使用了无线电源
status: 2 电池状态,2为充电状态,其他为非充电状态
level:85 电量(%)
scale: 100. 电量最大数值
voltage: 4180 当前电压(mV)
current now: -335232. 当前电流(mA)
temperature:290电池温度,单位为0.1摄氏度
technology:Li-poly. 电池种类
7.每秒帧数(流畅度)[fps]:
dumpsys gfxinfo 包名
PS: 最好先adb shell 进入安卓系统,在执行adb shell之后的语句。 windows系统dos窗口中grep换成find