xref: /aosp_15_r20/external/perfetto/traced_perf.rc (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1*6dbdd20aSAndroid Build Coastguard Worker# Copyright (C) 2020 The Android Open Source Project
2*6dbdd20aSAndroid Build Coastguard Worker#
3*6dbdd20aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*6dbdd20aSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*6dbdd20aSAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*6dbdd20aSAndroid Build Coastguard Worker#
7*6dbdd20aSAndroid Build Coastguard Worker#      http://www.apache.org/licenses/LICENSE-2.0
8*6dbdd20aSAndroid Build Coastguard Worker#
9*6dbdd20aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*6dbdd20aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*6dbdd20aSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*6dbdd20aSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*6dbdd20aSAndroid Build Coastguard Worker# limitations under the License.
14*6dbdd20aSAndroid Build Coastguard Worker
15*6dbdd20aSAndroid Build Coastguard Worker# Notes:
16*6dbdd20aSAndroid Build Coastguard Worker# * socket used for receiving /proc/pid/{maps,mem} file descriptors
17*6dbdd20aSAndroid Build Coastguard Worker# * readproc group to stat(/proc/pid) to find out UID of processes, and read
18*6dbdd20aSAndroid Build Coastguard Worker#   /proc/pid/cmdline.
19*6dbdd20aSAndroid Build Coastguard Worker# * KILL capability for sending BIONIC_SIGNAL_PROFILER.
20*6dbdd20aSAndroid Build Coastguard Worker# * DAC_READ_SEARCH capability for stack unwinding and on-device symbolization (requires
21*6dbdd20aSAndroid Build Coastguard Worker#   opening libraries/executables for sections not already mapped in).
22*6dbdd20aSAndroid Build Coastguard Worker# * foreground task group as unwinding based on minidebug info is a heavyweight action.
23*6dbdd20aSAndroid Build Coastguard Workerservice traced_perf /system/bin/traced_perf
24*6dbdd20aSAndroid Build Coastguard Worker    class late_start
25*6dbdd20aSAndroid Build Coastguard Worker    disabled
26*6dbdd20aSAndroid Build Coastguard Worker    socket traced_perf stream 0666 root root
27*6dbdd20aSAndroid Build Coastguard Worker    user nobody
28*6dbdd20aSAndroid Build Coastguard Worker    group nobody readproc readtracefs
29*6dbdd20aSAndroid Build Coastguard Worker    capabilities KILL DAC_READ_SEARCH
30*6dbdd20aSAndroid Build Coastguard Worker    task_profiles ProcessCapacityHigh
31*6dbdd20aSAndroid Build Coastguard Worker
32*6dbdd20aSAndroid Build Coastguard Worker# Daemon run state:
33*6dbdd20aSAndroid Build Coastguard Worker# * initially off
34*6dbdd20aSAndroid Build Coastguard Worker# * |persist.traced_perf.enable| forces daemon to run unconditionally
35*6dbdd20aSAndroid Build Coastguard Worker# * if kernel doesn't have perf_event_open LSM hooks, daemon is stopped
36*6dbdd20aSAndroid Build Coastguard Worker# * otherwise, follow |traced.lazy.traced_perf| as an on-demand service
37*6dbdd20aSAndroid Build Coastguard Workeron property:persist.traced_perf.enable=1
38*6dbdd20aSAndroid Build Coastguard Worker    start traced_perf
39*6dbdd20aSAndroid Build Coastguard Workeron property:persist.traced_perf.enable="" && property:sys.init.perf_lsm_hooks=""
40*6dbdd20aSAndroid Build Coastguard Worker    stop traced_perf
41*6dbdd20aSAndroid Build Coastguard Workeron property:persist.traced_perf.enable="" && property:sys.init.perf_lsm_hooks=1 && property:traced.lazy.traced_perf=1
42*6dbdd20aSAndroid Build Coastguard Worker    start traced_perf
43*6dbdd20aSAndroid Build Coastguard Workeron property:persist.traced_perf.enable="" && property:sys.init.perf_lsm_hooks=1 && property:traced.lazy.traced_perf=""
44*6dbdd20aSAndroid Build Coastguard Worker    stop traced_perf
45*6dbdd20aSAndroid Build Coastguard Worker
46*6dbdd20aSAndroid Build Coastguard Workeron property:persist.traced_perf.enable=0
47*6dbdd20aSAndroid Build Coastguard Worker    setprop persist.traced_perf.enable ""
48