We can use ‘systrace’ to analyze Android boot up performance
0. Read first
https://source.android.com/devices/tech/perf/boot-times#systrace
Following steps have been verified under Android AOSP 9.0.0_r30.
1. Enable systrace:
1.1 /system/etc/init/atrace.rc
$ adb pull /system/etc/init/atrace.rc
Change |
add following to atrace.rc:
on property:sys.boot_completed=1 |
$ adb push atrace.rc /system/etc/init/atrace.rc
1.2 /system/etc/prop.default
$ adb pull /system/etc/prop.default
change |
$ adb push prop.default /system/etc/prop.default
1.3 add kernel command line parameters
We can modify bootloader or boot.img to append following parameters
trace_buf_size=64M trace_event=sched_wakeup,sched_switch,sched_blocked_reason,sched_cpu_hotplug |
2. Fetch and analyze systrace:
$ git clone https://github.com/catapult-project/catapult.git --depth=10 |