1## Permissions to allow system-wide tracing to the kernel trace buffer. 2## 3on boot 4 5# Allow writing to the kernel trace log. 6 chmod 0222 /sys/kernel/debug/tracing/trace_marker 7 8# Allow the shell group to enable (some) kernel tracing. 9 chown root shell /sys/kernel/debug/tracing/trace_clock 10 chown root shell /sys/kernel/debug/tracing/buffer_size_kb 11 chown root shell /sys/kernel/debug/tracing/options/overwrite 12 chown root shell /sys/kernel/debug/tracing/options/print-tgid 13 chown root shell /sys/kernel/debug/tracing/events/sched/sched_switch/enable 14 chown root shell /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable 15 chown root shell /sys/kernel/debug/tracing/events/sched/sched_blocked_reason/enable 16 chown root shell /sys/kernel/debug/tracing/events/sched/sched_cpu_hotplug/enable 17 chown root shell /sys/kernel/debug/tracing/events/power/cpu_frequency/enable 18 chown root shell /sys/kernel/debug/tracing/events/power/cpu_idle/enable 19 chown root shell /sys/kernel/debug/tracing/events/power/clock_set_rate/enable 20 chown root shell /sys/kernel/debug/tracing/events/power/cpu_frequency_limits/enable 21 chown root shell /sys/kernel/debug/tracing/events/cpufreq_interactive/enable 22 chown root shell /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/enable 23 chown root shell /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_end/enable 24 chown root shell /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_wake/enable 25 chown root shell /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_sleep/enable 26 chown root shell /sys/kernel/debug/tracing/events/binder/binder_transaction/enable 27 chown root shell /sys/kernel/debug/tracing/events/binder/binder_transaction_received/enable 28 chown root shell /sys/kernel/debug/tracing/events/binder/binder_lock/enable 29 chown root shell /sys/kernel/debug/tracing/events/binder/binder_locked/enable 30 chown root shell /sys/kernel/debug/tracing/events/binder/binder_unlock/enable 31 32 chown root shell /sys/kernel/debug/tracing/tracing_on 33 34 chmod 0664 /sys/kernel/debug/tracing/trace_clock 35 chmod 0664 /sys/kernel/debug/tracing/buffer_size_kb 36 chmod 0664 /sys/kernel/debug/tracing/options/overwrite 37 chmod 0664 /sys/kernel/debug/tracing/options/print-tgid 38 chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_switch/enable 39 chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable 40 chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_blocked_reason/enable 41 chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_cpu_hotplug/enable 42 chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_frequency/enable 43 chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_idle/enable 44 chmod 0664 /sys/kernel/debug/tracing/events/power/clock_set_rate/enable 45 chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_frequency_limits/enable 46 chmod 0664 /sys/kernel/debug/tracing/events/cpufreq_interactive/enable 47 chmod 0664 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/enable 48 chmod 0664 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_end/enable 49 chmod 0664 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_wake/enable 50 chmod 0664 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_sleep/enable 51 chmod 0664 /sys/kernel/debug/tracing/tracing_on 52 chmod 0664 /sys/kernel/debug/tracing/events/binder/binder_transaction/enable 53 chmod 0664 /sys/kernel/debug/tracing/events/binder/binder_transaction_received/enable 54 chmod 0664 /sys/kernel/debug/tracing/events/binder/binder_lock/enable 55 chmod 0664 /sys/kernel/debug/tracing/events/binder/binder_locked/enable 56 chmod 0664 /sys/kernel/debug/tracing/events/binder/binder_unlock/enable 57 58 # Tracing disabled by default 59 write /sys/kernel/debug/tracing/tracing_on 0 60 61# Allow only the shell group to read and truncate the kernel trace. 62 chown root shell /sys/kernel/debug/tracing/trace 63 chmod 0660 /sys/kernel/debug/tracing/trace 64 65on property:persist.debug.atrace.boottrace=1 66 start boottrace 67 68# Run atrace with the categories written in a file 69service boottrace /system/bin/atrace --async_start -f /data/misc/boottrace/categories 70 disabled 71 oneshot 72