Merge "Check if RssAnon and swap were read" into rvc-dev am: b0a6429fcf am: 806f779ccd am: 582adfad6d

Change-Id: I5b21677992a1334e126ee435e648bc14eb2e856f
This commit is contained in:
TreeHugger Robot
2020-04-16 09:17:34 +00:00
committed by Automerger Merge Worker

View File

@@ -41,10 +41,11 @@ public final class ProcfsMemoryUtil {
public static MemorySnapshot readMemorySnapshotFromProcfs(int pid) {
long[] output = new long[STATUS_KEYS.length];
output[0] = -1;
output[3] = -1;
output[4] = -1;
Process.readProcLines("/proc/" + pid + "/status", STATUS_KEYS, output);
if (output[0] == -1 || (output[3] == 0 && output[4] == 0)) {
// Could not open file or anon rss / swap are 0 indicating the process is in a zombie
// state.
if (output[0] == -1 || output[3] == -1 || output[4] == -1) {
// Could not open or parse file.
return null;
}
final MemorySnapshot snapshot = new MemorySnapshot();