summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Rafal Slawik <rslawik@google.com> 2018-11-30 16:10:32 +0000
committer Rafal Slawik <rslawik@google.com> 2018-11-30 18:14:04 +0000
commit932c71eb84f9c69b590ffb00033755c9c04ab716 (patch)
tree97351c2835e03322a66807a0687b1bb66cb68710
parent46502d77743760df4d57f03570719b75f7e5b174 (diff)
Include zygote and drop unexpected samples
Verified that the unexpected samples are caused by zygote forking for a new app. We can drop those samples. Test: atest UidAtomTests#testNativeProcessMemoryState Change-Id: I12e5d772dd888ab7438db46b788b6026e1349b50
-rw-r--r--services/core/java/com/android/server/stats/StatsCompanionService.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java
index 39b12c279a7a..a31c63d165aa 100644
--- a/services/core/java/com/android/server/stats/StatsCompanionService.java
+++ b/services/core/java/com/android/server/stats/StatsCompanionService.java
@@ -195,10 +195,8 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
"/system/bin/traced", // Perfetto.
"/system/bin/traced_probes", // Perfetto.
"webview_zygote",
- // Temporarily excluded zygote to investigate its forking consequences in
- // NativeProcessMemoryState.
- // "zygote",
- // "zygote64",
+ "zygote",
+ "zygote64",
};
@@ -1089,6 +1087,7 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
private void pullNativeProcessMemoryState(
int tagId, long elapsedNanos, long wallClockNanos,
List<StatsLogEventWrapper> pulledData) {
+ final List<String> processNames = Arrays.asList(MEMORY_INTERESTING_NATIVE_PROCESSES);
int[] pids = getPidsForCommands(MEMORY_INTERESTING_NATIVE_PROCESSES);
for (int i = 0; i < pids.length; i++) {
int pid = pids[i];
@@ -1098,6 +1097,12 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
}
int uid = getUidForPid(pid);
String processName = readCmdlineFromProcfs(pid);
+ // Sometimes we get here processName that is not included in the whitelist. It comes
+ // from forking the zygote for an app. We can ignore that sample because this process
+ // is collected by ProcessMemoryState.
+ if (!processNames.contains(processName)) {
+ continue;
+ }
StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
e.writeInt(uid);
e.writeString(processName);