initrc file for Perfetto
This CL turns the perfetto daemons into two standalone
executable. Given the amount of shared code between the
two (traced and traced_probes) the code is shared in a
.so library.
Also adds the corresponding initrc files.
Corresponding /sepolicy/ changes:
https://android-review.googlesource.com/c/platform/system/sepolicy/+/574422
Change-Id: I3566d31757dd7fbf2478ca6512a6b655753a7fd6
diff --git a/Android.bp b/Android.bp
index 4e32744..47d8b10 100644
--- a/Android.bp
+++ b/Android.bp
@@ -900,6 +900,9 @@
"libtraced_shared",
"libutils",
],
+ init_rc: [
+ "perfetto.rc",
+ ],
defaults: [
"perfetto_defaults",
],
diff --git a/perfetto.rc b/perfetto.rc
new file mode 100644
index 0000000..6ae1e00
--- /dev/null
+++ b/perfetto.rc
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+service traced /system/bin/traced
+ class late_start
+ disabled
+ socket traced_consumer stream 0666 root root
+ socket traced_producer stream 0666 root root
+ user nobody
+ group nobody
+ writepid /dev/cpuset/system-background/tasks
+
+service traced_probes /system/bin/traced_probes
+ class late_start
+ disabled
+ user nobody
+ group shell
+ writepid /dev/cpuset/system-background/tasks
+
+on property:perfetto.service.enable=true
+ start traced
+ start traced_probes
diff --git a/tools/gen_android_bp b/tools/gen_android_bp
index 79416d4..0f7a05c 100755
--- a/tools/gen_android_bp
+++ b/tools/gen_android_bp
@@ -37,7 +37,6 @@
# Default targets to translate to the blueprint file.
default_targets = [
'//:libtraced_shared',
- '//:perfetto',
'//:perfetto_tests',
'//:perfetto',
'//:traced',
@@ -47,7 +46,9 @@
# Defines a custom init_rc argument to be applied to the corresponding output
# blueprint target.
-target_initrc = {} # TODO(primiano): populate in upcoming CLs.
+target_initrc = {
+ '//:traced': 'perfetto.rc',
+}
# Arguments for the GN output directory.
gn_args = 'target_os="android" target_cpu="arm" is_debug=false build_with_android=true'