官方文档:
https://perfetto.dev/docs/quickstart/android-tracing
一、
# Needed only on Android 9 (P) and 10 (Q) on non-Pixel phones.
adb shell setprop persist.traced.enable 1
二、下载external/perfetto/tools/record_android_trace
Using the tools/record_android_trace helper script.
三、抓日志
record_android_trace -o $(date +%Y%m%d_%H%M%S)_trace_file.perfetto-trace -t 5s -b 32mb sched freq idle am wm gfx view binder_driver hal dalvik camera input res memory gfx view wm am ss video camera hal res sync idle binder_driver binder_lock ss
抓取完毕后,会自动存储到当前目录的 $(date +%Y%m%d_%H%M%S)_trace_file.perfetto-trace