Ryan Savitski | 29082bf | 2020-02-12 15:13:51 +0000 | [diff] [blame] | 1 | # Copyright (C) 2020 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 | |
Ryan | 87227fa | 2020-03-24 16:16:30 +0000 | [diff] [blame] | 15 | # Notes: |
| 16 | # * socket used for receiving /proc/pid/{maps,mem} file descriptors |
| 17 | # * readproc group to stat(/proc/pid) to find out UID of processes, and read |
| 18 | # /proc/pid/cmdline. |
| 19 | # * KILL capability for sending BIONIC_SIGNAL_PROFILER. |
| 20 | # * DAC_READ_SEARCH capability for stack unwinding and on-device symbolization (requires |
| 21 | # opening libraries/executables for sections not already mapped in). |
| 22 | # * foreground task group as unwinding based on minidebug info is a heavyweight action. |
Ryan Savitski | 29082bf | 2020-02-12 15:13:51 +0000 | [diff] [blame] | 23 | service traced_perf /system/bin/traced_perf |
| 24 | class late_start |
Ryan Savitski | bea646e | 2020-03-26 21:02:03 +0000 | [diff] [blame] | 25 | disabled |
Ryan Savitski | 29082bf | 2020-02-12 15:13:51 +0000 | [diff] [blame] | 26 | socket traced_perf stream 0666 root root |
| 27 | user nobody |
Ryan Savitski | 29082bf | 2020-02-12 15:13:51 +0000 | [diff] [blame] | 28 | group nobody readproc |
Ryan Savitski | 29082bf | 2020-02-12 15:13:51 +0000 | [diff] [blame] | 29 | capabilities KILL DAC_READ_SEARCH |
Suren Baghdasaryan | a08f53b | 2021-06-17 18:48:43 -0700 | [diff] [blame^] | 30 | task_profiles ProcessCapacityHigh |
Ryan Savitski | 29082bf | 2020-02-12 15:13:51 +0000 | [diff] [blame] | 31 | |
Ryan | 87227fa | 2020-03-24 16:16:30 +0000 | [diff] [blame] | 32 | # Daemon run state: |
Ryan Savitski | bea646e | 2020-03-26 21:02:03 +0000 | [diff] [blame] | 33 | # * initially off |
Ryan | 87227fa | 2020-03-24 16:16:30 +0000 | [diff] [blame] | 34 | # * |persist.traced_perf.enable| forces daemon to run unconditionally |
| 35 | # * if kernel doesn't have perf_event_open LSM hooks, daemon is stopped |
| 36 | # * otherwise, follow |traced.lazy.traced_perf| as an on-demand service |
Ryan Savitski | 29082bf | 2020-02-12 15:13:51 +0000 | [diff] [blame] | 37 | on property:persist.traced_perf.enable=1 |
| 38 | start traced_perf |
Ryan Savitski | bea646e | 2020-03-26 21:02:03 +0000 | [diff] [blame] | 39 | on property:persist.traced_perf.enable="" && property:sys.init.perf_lsm_hooks="" |
Ryan | 87227fa | 2020-03-24 16:16:30 +0000 | [diff] [blame] | 40 | stop traced_perf |
Ryan Savitski | bea646e | 2020-03-26 21:02:03 +0000 | [diff] [blame] | 41 | on property:persist.traced_perf.enable="" && property:sys.init.perf_lsm_hooks=1 && property:traced.lazy.traced_perf=1 |
Ryan | 87227fa | 2020-03-24 16:16:30 +0000 | [diff] [blame] | 42 | start traced_perf |
Ryan Savitski | bea646e | 2020-03-26 21:02:03 +0000 | [diff] [blame] | 43 | on property:persist.traced_perf.enable="" && property:sys.init.perf_lsm_hooks=1 && property:traced.lazy.traced_perf="" |
Ryan Savitski | 29082bf | 2020-02-12 15:13:51 +0000 | [diff] [blame] | 44 | stop traced_perf |
| 45 | |
Ryan Savitski | bea646e | 2020-03-26 21:02:03 +0000 | [diff] [blame] | 46 | on property:persist.traced_perf.enable=0 |
| 47 | setprop persist.traced_perf.enable "" |