summaryrefslogtreecommitdiff
path: root/toolchain-extras
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2019-06-04 15:33:45 -0700
committerPirama Arumuga Nainar <pirama@google.com>2019-06-05 21:39:32 +0000
commit5b9defd41d61b000c82c84662f02394e89192d93 (patch)
treee12c3400244d1346fa7c12e09f22572645144fdc /toolchain-extras
parente76c23dc6b7bff0c7404744b9bdde0d02465acdf (diff)
downloadextras-5b9defd41d61b000c82c84662f02394e89192d93.tar.gz
Refactor property-watch optout logic
Bug: http://b/116873221 Refactor the processes without property-watch thread into a list. Test: Build cuttlefish with coverage Change-Id: Id8f0ceab133b961219b1cf77ae02b00eba4cfaf5
Diffstat (limited to 'toolchain-extras')
-rw-r--r--toolchain-extras/profile-extras.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/toolchain-extras/profile-extras.cpp b/toolchain-extras/profile-extras.cpp
index f999a6b2..cdb19e8f 100644
--- a/toolchain-extras/profile-extras.cpp
+++ b/toolchain-extras/profile-extras.cpp
@@ -67,6 +67,18 @@ void *property_watch_loop(__unused void *arg) {
}
}
+#if defined(__ANDROID_API__) && __ANDROID_API__ >= __ANDROID_API_L__
+static char prop_watch_disabled_procs[][128] = {
+ "zygote",
+ "zygote32",
+ "app_process",
+ "app_process32",
+};
+
+static size_t prop_watch_num_disabled_procs = \
+ sizeof(prop_watch_disabled_procs) / sizeof(prop_watch_disabled_procs[0]);
+#endif
+
__attribute__((weak)) int init_profile_extras_once = 0;
// Initialize libprofile-extras:
@@ -98,11 +110,10 @@ __attribute__((constructor)) int init_profile_extras(void) {
// getprogname() was added.
#if defined(__ANDROID_API__) && __ANDROID_API__ >= __ANDROID_API_L__
const char *prog_basename = basename(getprogname());
- if (strncmp(prog_basename, "zygote", strlen("zygote")) == 0) {
- return 0;
- }
- if (strncmp(prog_basename, "app_process", strlen("app_process")) == 0) {
- return 0;
+ for (size_t i = 0; i < prop_watch_num_disabled_procs; i ++) {
+ if (strcmp(prog_basename, prop_watch_disabled_procs[i]) == 0) {
+ return 0;
+ }
}
#endif