Florian Mayer | 7a5d83b | 2018-10-18 18:57:02 +0100 | [diff] [blame] | 1 | # Copyright (C) 2018 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 | service heapprofd /system/bin/heapprofd |
| 15 | class late_start |
| 16 | disabled |
| 17 | socket heapprofd stream 0666 root root |
| 18 | user nobody |
Florian Mayer | 7ea4c08 | 2018-11-13 14:44:39 +0000 | [diff] [blame] | 19 | group nobody readproc |
Florian Mayer | bf5a070 | 2019-04-03 12:12:41 +0100 | [diff] [blame] | 20 | # By default, this daemon is idle. When profiling an app, we should unwind |
| 21 | # as fast as possible in the interest of the app being profiled. |
Suren Baghdasaryan | a08f53b | 2021-06-17 18:48:43 -0700 | [diff] [blame] | 22 | task_profiles ProcessCapacityHigh |
Florian Mayer | a5bb65d | 2018-11-28 11:24:28 +0000 | [diff] [blame] | 23 | onrestart exec_background - nobody shell -- /system/bin/heapprofd --cleanup-after-crash |
Florian Mayer | b4b0f33 | 2019-03-21 18:15:00 +0000 | [diff] [blame] | 24 | # DAC_READ_SEARCH is denied by SELinux on user builds because the SELinux |
| 25 | # permission is userdebug_or_eng only. |
Florian Mayer | a2994aa | 2019-07-02 13:17:16 +0100 | [diff] [blame] | 26 | capabilities KILL DAC_READ_SEARCH |
Florian Mayer | e30f722 | 2018-12-10 15:03:37 +0000 | [diff] [blame] | 27 | |
Florian Mayer | e4b9f0f | 2021-01-13 19:43:53 +0000 | [diff] [blame] | 28 | # Allow to start a second heapprofd. We can use that one to profile the |
| 29 | # primary one. See src/memory/profiling/README.md. |
| 30 | service heapprofd_secondary /system/bin/heapprofd |
| 31 | disabled |
| 32 | oneshot |
| 33 | socket heapprofd stream 0666 root root |
| 34 | user nobody |
| 35 | group nobody readproc |
| 36 | # By default, this daemon is idle. When profiling an app, we should unwind |
| 37 | # as fast as possible in the interest of the app being profiled. |
Suren Baghdasaryan | a08f53b | 2021-06-17 18:48:43 -0700 | [diff] [blame] | 38 | task_profiles ProcessCapacityHigh |
Florian Mayer | e4b9f0f | 2021-01-13 19:43:53 +0000 | [diff] [blame] | 39 | # DAC_READ_SEARCH is denied by SELinux on user builds because the SELinux |
| 40 | # permission is userdebug_or_eng only. |
| 41 | capabilities KILL DAC_READ_SEARCH |
| 42 | |
Florian Mayer | e30f722 | 2018-12-10 15:03:37 +0000 | [diff] [blame] | 43 | on property:persist.heapprofd.enable=1 |
| 44 | start heapprofd |
| 45 | |
Florian Mayer | 3077d18 | 2019-03-15 14:30:04 -0700 | [diff] [blame] | 46 | on property:traced.lazy.heapprofd=1 |
| 47 | start heapprofd |
| 48 | |
Ryan Savitski | bea646e | 2020-03-26 21:02:03 +0000 | [diff] [blame] | 49 | on property:persist.heapprofd.enable="" && property:traced.lazy.heapprofd="" |
Florian Mayer | e30f722 | 2018-12-10 15:03:37 +0000 | [diff] [blame] | 50 | stop heapprofd |
Ryan Savitski | bea646e | 2020-03-26 21:02:03 +0000 | [diff] [blame] | 51 | |
| 52 | on property:persist.heapprofd.enable=0 |
| 53 | setprop persist.heapprofd.enable "" |