atrace.rc revision 69915f973399a8b4e948877ce0cadead1e1a577a
1## Permissions to allow system-wide tracing to the kernel trace buffer.
2##
3on post-fs
4
5# Allow writing to the kernel trace log.
6    chmod 0222 /sys/kernel/debug/tracing/trace_marker
7    chmod 0222 /sys/kernel/tracing/trace_marker
8
9# Allow the shell group to enable (some) kernel tracing.
10    chown root shell /sys/kernel/debug/tracing/trace_clock
11    chown root shell /sys/kernel/tracing/trace_clock
12    chown root shell /sys/kernel/debug/tracing/buffer_size_kb
13    chown root shell /sys/kernel/tracing/buffer_size_kb
14    chown root shell /sys/kernel/debug/tracing/options/overwrite
15    chown root shell /sys/kernel/tracing/options/overwrite
16    chown root shell /sys/kernel/debug/tracing/options/print-tgid
17    chown root shell /sys/kernel/tracing/options/print-tgid
18    chown root shell /sys/kernel/debug/tracing/events/sched/sched_switch/enable
19    chown root shell /sys/kernel/tracing/events/sched/sched_switch/enable
20    chown root shell /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
21    chown root shell /sys/kernel/tracing/events/sched/sched_wakeup/enable
22    chown root shell /sys/kernel/debug/tracing/events/sched/sched_blocked_reason/enable
23    chown root shell /sys/kernel/tracing/events/sched/sched_blocked_reason/enable
24    chown root shell /sys/kernel/debug/tracing/events/sched/sched_cpu_hotplug/enable
25    chown root shell /sys/kernel/tracing/events/sched/sched_cpu_hotplug/enable
26    chown root shell /sys/kernel/debug/tracing/events/power/cpu_frequency/enable
27    chown root shell /sys/kernel/tracing/events/power/cpu_frequency/enable
28    chown root shell /sys/kernel/debug/tracing/events/power/cpu_idle/enable
29    chown root shell /sys/kernel/tracing/events/power/cpu_idle/enable
30    chown root shell /sys/kernel/debug/tracing/events/power/clock_set_rate/enable
31    chown root shell /sys/kernel/tracing/events/power/clock_set_rate/enable
32    chown root shell /sys/kernel/debug/tracing/events/power/cpu_frequency_limits/enable
33    chown root shell /sys/kernel/tracing/events/power/cpu_frequency_limits/enable
34    chown root shell /sys/kernel/debug/tracing/events/cpufreq_interactive/enable
35    chown root shell /sys/kernel/tracing/events/cpufreq_interactive/enable
36    chown root shell /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/enable
37    chown root shell /sys/kernel/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/enable
38    chown root shell /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_end/enable
39    chown root shell /sys/kernel/tracing/events/vmscan/mm_vmscan_direct_reclaim_end/enable
40    chown root shell /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_wake/enable
41    chown root shell /sys/kernel/tracing/events/vmscan/mm_vmscan_kswapd_wake/enable
42    chown root shell /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_sleep/enable
43    chown root shell /sys/kernel/tracing/events/vmscan/mm_vmscan_kswapd_sleep/enable
44    chown root shell /sys/kernel/debug/tracing/events/binder/binder_transaction/enable
45    chown root shell /sys/kernel/tracing/events/binder/binder_transaction/enable
46    chown root shell /sys/kernel/debug/tracing/events/binder/binder_transaction_received/enable
47    chown root shell /sys/kernel/tracing/events/binder/binder_transaction_received/enable
48    chown root shell /sys/kernel/debug/tracing/events/binder/binder_lock/enable
49    chown root shell /sys/kernel/tracing/events/binder/binder_lock/enable
50    chown root shell /sys/kernel/debug/tracing/events/binder/binder_locked/enable
51    chown root shell /sys/kernel/tracing/events/binder/binder_locked/enable
52    chown root shell /sys/kernel/debug/tracing/events/binder/binder_unlock/enable
53    chown root shell /sys/kernel/tracing/events/binder/binder_unlock/enable
54
55    chown root shell /sys/kernel/debug/tracing/tracing_on
56    chown root shell /sys/kernel/tracing/tracing_on
57
58    chmod 0664 /sys/kernel/debug/tracing/trace_clock
59    chmod 0664 /sys/kernel/tracing/trace_clock
60    chmod 0664 /sys/kernel/debug/tracing/buffer_size_kb
61    chmod 0664 /sys/kernel/tracing/buffer_size_kb
62    chmod 0664 /sys/kernel/debug/tracing/options/overwrite
63    chmod 0664 /sys/kernel/tracing/options/overwrite
64    chmod 0664 /sys/kernel/debug/tracing/options/print-tgid
65    chmod 0664 /sys/kernel/tracing/options/print-tgid
66    chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_switch/enable
67    chmod 0664 /sys/kernel/tracing/events/sched/sched_switch/enable
68    chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
69    chmod 0664 /sys/kernel/tracing/events/sched/sched_wakeup/enable
70    chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_blocked_reason/enable
71    chmod 0664 /sys/kernel/tracing/events/sched/sched_blocked_reason/enable
72    chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_cpu_hotplug/enable
73    chmod 0664 /sys/kernel/tracing/events/sched/sched_cpu_hotplug/enable
74    chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_frequency/enable
75    chmod 0664 /sys/kernel/tracing/events/power/cpu_frequency/enable
76    chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_idle/enable
77    chmod 0664 /sys/kernel/tracing/events/power/cpu_idle/enable
78    chmod 0664 /sys/kernel/debug/tracing/events/power/clock_set_rate/enable
79    chmod 0664 /sys/kernel/tracing/events/power/clock_set_rate/enable
80    chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_frequency_limits/enable
81    chmod 0664 /sys/kernel/tracing/events/power/cpu_frequency_limits/enable
82    chmod 0664 /sys/kernel/debug/tracing/events/cpufreq_interactive/enable
83    chmod 0664 /sys/kernel/tracing/events/cpufreq_interactive/enable
84    chmod 0664 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/enable
85    chmod 0664 /sys/kernel/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/enable
86    chmod 0664 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_end/enable
87    chmod 0664 /sys/kernel/tracing/events/vmscan/mm_vmscan_direct_reclaim_end/enable
88    chmod 0664 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_wake/enable
89    chmod 0664 /sys/kernel/tracing/events/vmscan/mm_vmscan_kswapd_wake/enable
90    chmod 0664 /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_sleep/enable
91    chmod 0664 /sys/kernel/tracing/events/vmscan/mm_vmscan_kswapd_sleep/enable
92    chmod 0664 /sys/kernel/debug/tracing/tracing_on
93    chmod 0664 /sys/kernel/tracing/tracing_on
94    chmod 0664 /sys/kernel/debug/tracing/events/binder/binder_transaction/enable
95    chmod 0664 /sys/kernel/tracing/events/binder/binder_transaction/enable
96    chmod 0664 /sys/kernel/debug/tracing/events/binder/binder_transaction_received/enable
97    chmod 0664 /sys/kernel/tracing/events/binder/binder_transaction_received/enable
98    chmod 0664 /sys/kernel/debug/tracing/events/binder/binder_lock/enable
99    chmod 0664 /sys/kernel/tracing/events/binder/binder_lock/enable
100    chmod 0664 /sys/kernel/debug/tracing/events/binder/binder_locked/enable
101    chmod 0664 /sys/kernel/tracing/events/binder/binder_locked/enable
102    chmod 0664 /sys/kernel/debug/tracing/events/binder/binder_unlock/enable
103    chmod 0664 /sys/kernel/tracing/events/binder/binder_unlock/enable
104    chmod 0664 /sys/kernel/debug/tracing/events/i2c/enable
105    chmod 0664 /sys/kernel/tracing/events/i2c/enable
106    chmod 0664 /sys/kernel/debug/tracing/events/i2c/i2c_read/enable
107    chmod 0664 /sys/kernel/tracing/events/i2c/i2c_read/enable
108    chmod 0664 /sys/kernel/debug/tracing/events/i2c/i2c_write/enable
109    chmod 0664 /sys/kernel/tracing/events/i2c/i2c_write/enable
110    chmod 0664 /sys/kernel/debug/tracing/events/i2c/i2c_result/enable
111    chmod 0664 /sys/kernel/tracing/events/i2c/i2c_result/enable
112    chmod 0664 /sys/kernel/debug/tracing/events/i2c/i2c_reply/enable
113    chmod 0664 /sys/kernel/tracing/events/i2c/i2c_reply/enable
114    chmod 0664 /sys/kernel/debug/tracing/events/i2c/smbus_read/enable
115    chmod 0664 /sys/kernel/tracing/events/i2c/smbus_read/enable
116    chmod 0664 /sys/kernel/debug/tracing/events/i2c/smbus_write/enable
117    chmod 0664 /sys/kernel/tracing/events/i2c/smbus_write/enable
118    chmod 0664 /sys/kernel/debug/tracing/events/i2c/smbus_result/enable
119    chmod 0664 /sys/kernel/tracing/events/i2c/smbus_result/enable
120    chmod 0664 /sys/kernel/debug/tracing/events/i2c/smbus_reply/enable
121    chmod 0664 /sys/kernel/tracing/events/i2c/smbus_reply/enable
122
123    # Tracing disabled by default
124    write /sys/kernel/debug/tracing/tracing_on 0
125    write /sys/kernel/tracing/tracing_on 0
126
127# Allow only the shell group to read and truncate the kernel trace.
128    chown root shell /sys/kernel/debug/tracing/trace
129    chown root shell /sys/kernel/tracing/trace
130    chmod 0660 /sys/kernel/debug/tracing/trace
131    chmod 0660 /sys/kernel/tracing/trace
132
133on property:persist.debug.atrace.boottrace=1
134    start boottrace
135
136# Run atrace with the categories written in a file
137service boottrace /system/bin/atrace --async_start -f /data/misc/boottrace/categories
138    disabled
139    oneshot
140