参考:https://www.jianshu.com/p/2604b426be5d
1.在开发者选项勾选GPU呈现模式分析
选中 adb shell dumpsys gfxinfo
2.打开应用,滑动页面
使用 adb shell "dumpsys window|grep mCurrentFocus" 可查询当前Activity
3.导出fps文件
adb shell dumpsys gfxinfo 包名 > F:\FPS.txt
打开导出文件,有四项
Draw Prepare Process Execute
50.00 1.07 27.58 1.22
46.49 0.93 2.44 0.84
6.15 2.24 10.69 2.22
Draw: 表示在Java中创建显示列表部分中,OnDraw()方法占用的时间。
Prepare:表示程序准备时间
Process:表示渲染引擎执行显示列表所花的时间,view越多,时间就越长
Execute:表示把一帧数据发送到屏幕上排版显示实际花费的时间。
Draw + Prepare+Process + Execute = 完整显示一帧 ,这个时间要小于16ms才能保存每秒60帧。
ps:
通过Choreographer检测UI丢帧和卡顿
https://blog.csdn.net/zhangphil/article/details/81129246