Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 932c71eb authored by Rafal Slawik's avatar Rafal Slawik
Browse files

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
parent 46502d77
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -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);