将 Android Frame Pacing 集成到游戏中后,请务必验证其功能是否使游戏实现了更加一致的帧同步。可用于确认此项改进的最佳工具是 systrace
命令行程序。具体而言,最好使用下面这组参数来捕获游戏的跟踪记录:
python systrace.py -a your-app-package-name -o mygametrace.html \ sched freq idle am wm gfx view sync binder_driver hal input aidl
查看输出 HTML 报告时,您可以在 SurfaceView 通道中找到与帧同步相关的信息。此通道会报告显示流水线中缓冲的帧数。将 Android Frame Pacing 成功集成到游戏中之后,您会看到此计数器(图 1)中所有不一致的帧同步变得稳定了(图 2)。
![显示 SurfaceView 通道的 Systrace 报告](https://developer.android.google.cn/static/images/games/frame-pacing-without-afp.png?authuser=2&hl=zh-cn)
![显示 SurfaceView 通道的 Systrace 报告](https://developer.android.google.cn/static/images/games/frame-pacing-with-afp.png?authuser=2&hl=zh-cn)