Primiano Tucci | 5a30453 | 2018-01-09 14:15:43 +0000 | [diff] [blame] | 1 | # Copyright (C) 2017 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | service traced /system/bin/traced |
| 16 | class late_start |
| 17 | disabled |
| 18 | socket traced_consumer stream 0666 root root |
| 19 | socket traced_producer stream 0666 root root |
| 20 | user nobody |
| 21 | group nobody |
| 22 | writepid /dev/cpuset/system-background/tasks |
| 23 | |
| 24 | service traced_probes /system/bin/traced_probes |
| 25 | class late_start |
| 26 | disabled |
| 27 | user nobody |
Primiano Tucci | a364520 | 2020-08-03 16:28:18 +0200 | [diff] [blame] | 28 | # Despite the "log" group below, traced_probes is allowed to read log |
| 29 | # only on userdebug/eng via selinux (see traced_probes.te). |
Primiano Tucci | 8be3727 | 2019-01-10 22:18:31 +0000 | [diff] [blame] | 30 | group nobody readproc log |
Primiano Tucci | 5a30453 | 2018-01-09 14:15:43 +0000 | [diff] [blame] | 31 | writepid /dev/cpuset/system-background/tasks |
Florian Mayer | 7d1a9a2 | 2018-02-14 15:17:58 +0000 | [diff] [blame] | 32 | # Clean up procfs configuration even if traced_probes crashes |
| 33 | # unexpectedly. |
| 34 | onrestart exec_background - nobody shell -- /system/bin/traced_probes --cleanup-after-crash |
Florian Mayer | a98c6f5 | 2018-02-19 13:56:07 +0000 | [diff] [blame] | 35 | file /dev/kmsg w |
Primiano Tucci | d6e8485 | 2018-03-29 20:26:57 +0000 | [diff] [blame] | 36 | capabilities DAC_READ_SEARCH |
Primiano Tucci | 5a30453 | 2018-01-09 14:15:43 +0000 | [diff] [blame] | 37 | |
Hector Dearman | f1d1cd8 | 2019-04-05 16:25:10 +0100 | [diff] [blame] | 38 | on property:persist.device_config.global_settings.sys_traced=1 |
Hector Dearman | e9bdfe5 | 2018-03-21 13:24:28 +0000 | [diff] [blame] | 39 | setprop persist.traced.enable 1 |
| 40 | |
Hector Dearman | f1d1cd8 | 2019-04-05 16:25:10 +0100 | [diff] [blame] | 41 | on property:persist.device_config.global_settings.sys_traced=0 |
Hector Dearman | e9bdfe5 | 2018-03-21 13:24:28 +0000 | [diff] [blame] | 42 | setprop persist.traced.enable 0 |
| 43 | |
Lalit Maganti | dabc529 | 2018-05-23 19:18:55 +0100 | [diff] [blame] | 44 | on property:debug.atrace.user_initiated=1 |
| 45 | stop traced_probes |
| 46 | |
| 47 | on property:persist.traced.enable=1 && property:debug.atrace.user_initiated="" |
| 48 | start traced_probes |
| 49 | |
Primiano Tucci | 7175882 | 2018-01-25 12:51:45 +0000 | [diff] [blame] | 50 | on property:persist.traced.enable=1 |
Primiano Tucci | 7e2b67a | 2018-01-16 16:38:49 +0000 | [diff] [blame] | 51 | # Trace files need to be: |
| 52 | # - Written by either uid:shell or uid:statsd. |
Primiano Tucci | 7175882 | 2018-01-25 12:51:45 +0000 | [diff] [blame] | 53 | # - Read by shell and dropbox (dropbox is part of system_server). |
Primiano Tucci | 7e2b67a | 2018-01-16 16:38:49 +0000 | [diff] [blame] | 54 | # When written to dropbox, they are persistet in the perfetto-traces folder |
| 55 | # only for the time it takes to make a dropbox call, and unlinked |
| 56 | # immediately in any case. |
| 57 | mkdir /data/misc/perfetto-traces 0773 root shell |
| 58 | |
Primiano Tucci | 5a30453 | 2018-01-09 14:15:43 +0000 | [diff] [blame] | 59 | start traced |
| 60 | start traced_probes |
Hector Dearman | 7549fff | 2018-02-09 17:25:30 +0000 | [diff] [blame] | 61 | |
| 62 | on property:persist.traced.enable=0 |
| 63 | stop traced |
| 64 | stop traced_probes |
Hector Dearman | dedfd76 | 2019-11-28 18:13:49 +0000 | [diff] [blame] | 65 | |
| 66 | # Reset the Perfetto guard rail state on boot: |
| 67 | on post-fs-data |
| 68 | rm /data/misc/perfetto-traces/.guardraildata |