压力崩溃
monkey (adb命令)
遍历
Maxim
https://github.com/zhangzhao4444/Maxim
1 2 3
| adb shell CLASSPATH=/data/local/tmp/monkey.jar:/data/local/tmp/framework.jar exec app_process /system/bin tv.panda.test.monkey.Monkey -p com.panda.videoliveplatform --uiautomatormix --running-minutes 6 -v -v --throttle 400 --output-directory /data/local/tmp/ # gitbash下 adb shell CLASSPATH=//data/local/tmp/monkey.jar://data/local/tmp/framework.jar exec app_process //system/bin tv.panda.test.monkey.Monkey -p com.panda.videoliveplatform --uiautomatormix --running-minutes 6 -v -v --throttle 400 --output-directory //data/local/tmp/
|
NoSmoke
https://github.com/macacajs/NoSmoke
性能分析工具
sdk tools下性能分析工具monitor mothod
执行android-sdk-windows\tools\monitor.bat即可运行,可以分析app运行的性能。
studio mothod工具
mothod cpu mem
堆文件hprof diff
hprof-conv xx.hprof xx.jvm.hprof
jvm内存分析工具(可分析上面的堆文件)
jvisualvm
卡顿检测
systrace工具
1
| py -2 /d/software/Android/android-sdk/platform-tools/systrace
|
关键硬件资源的占⽤率
1 2 3 4 5
| adb shell dumpsys procstats --hours 3 adb shell dumpsys meminfo package_name|pid [-d] adb shell dumpsys batterystats --charged packagename adb shell dumpsys netstats detail adb shell dumpsys gfxinfo package-name
|
录屏截图分析
录屏
1
| adb shell screenrecord --bugreport --time-limit 30 //xx/xx.mp4
|
截图
拆帧工具ffmpeg
1 2
| ffmpeg -i xxxx.mp4 -r 20 img-%03d.png ffmpeg -i xxxx.mp -ss 00:00:08.88 -to 00:00:11.11 xx.gif
|
网页资源加载分析
webview
w3c performance api
example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| 查看activity的创建时间 package=com.xueqiu.android 清理缓存数据: adb shell pm clear $package 停止进程: adb shell am force-stop $package 启动app: adb shell an start -S -W $package/.view.WelcomeActivityAlias 获取数据: adb logcat | grep "Displayed "
对接influxdb&Grafana可视化监控平台 pids=$(adb shell ps -ef | grep xxx | head -1 |grep -v grep | awk '{print $2}' | xargs | sed 's# #,#g') adb shell top -d 1 -n 1 -p $pids adb shell top -d 1 -p $pids -o %CPU,%MEM,NAME -n 1 -b | grep xxx
pids=$(adb shell ps -ef | grep xxx | grep -v grep | awk '{print $2}' | xargs | sed 's# #,#g') for(i=0;<20:;++); do content=$(adb shell top -d 1 p $pids -0 %CPU,%MEM,NAME n 1 -b | grep bili) echo $content cpu=$(echo "Sconten" | awk print $1) mem=$(echo "Scontent" | awk {print $2}) echo curl -i -XPOST 'http://192.168.13.1:8086/write?db=testdb" --data-binary "cpu.user-$USER.app=bill value=$cpu" echo curl -i -XPOST 'http://192.168.13.1:8086/write?db=testdb' --data-binary "mem.user-$USER.app=bill value=$mem" done
|