参考流程:
https://www.jianshu.com/p/03c40afab7a5?utm_campaign
工具位置:
external/chromium-trace/systrace.py
保存下面的代码到settrace.sh, 在抓取之前先执行下面指令 source settrace.sh
adb remount
adb shell setenforce 0
adb shell "echo 0 > /sys/kernel/debug/tracing/tracing_on"
adb shell "echo > /sys/kernel/debug/tracing/trace"
adb shell "echo 51200 > /sys/kernel/debug/tracing/buffer_size_kb"
adb shell "echo thermal:* > /sys/kernel/debug/tracing/set_event"
adb shell "echo msm_low_power:* >> /sys/kernel/debug/tracing/set_event"
adb shell "echo sched:sched_migrate_task >> /sys/kernel/debug/tracing/set_event"
adb shell "echo sched:sched_switch >> /sys/kernel/debug/tracing/set_event"
adb shell "echo sched:sched_wakeup >> /sys/kernel/debug/tracing/set_event"
adb shell "echo sched:sched_cpu_load >> /sys/kernel/debug/tracing/set_event"
adb shell "echo core_ctl_eval_need >> /sys/kernel/debug/tracing/set_event"
adb shell "echo cpufreq_interactive:* >> /d/tracing/set_event"
adb shell "echo kgsl:* >> /d/tracing/set_event"
adb shell "echo mdss:* >> /d/tracing/set_event"
adb shell "echo irq:* >> /sys/kernel/debug/tracing/set_event"
adb shell "cat /sys/kernel/debug/tracing/set_event"
抓取方法:
- Frame drop issue on browsing, gaming, and UX 丢帧问题,浏览,游戏,和UX
$ python systrace.py gfx input view sched am wm dalvik freq idle load sync workq power mmc disk -b 40000 -t 10 -o output.html
- Application launch latency 应用程序启动延迟
$ python systrace.py gfx input sched am wm dalvik freq idle load sync workq power mmc disk -b 40000 -t 10 -o output.html
- Audio quality issue 音频质量问题
$ python systrace.py sched dalvik freq idle load sync workq power mmc disk audio hal res -b 40000 -t 10 -o output.html
- Camera frame drop issue 相机帧下降问题
$ python systrace.py gfx sched am wm dalvik freq idle load sync workq power mmc disk camera hal res membus -b 40000 -t 10 -o output.html
- Video frame drop issue 视频帧下降问题
$ python systrace.py gfx sched am wm dalvik freq idle load sync workq power mmc disk video audio hal res membus –b 40000 –t 10 -o output.html