diff options
| author | 2019-08-20 04:43:19 +0000 | |
|---|---|---|
| committer | 2019-08-20 04:43:19 +0000 | |
| commit | 44deae325c90707d0ab3fb35f7aa65e7f66a823e (patch) | |
| tree | 13e0de26cf6d13c75bbea781d73ebf7a7e6f1009 | |
| parent | 2b1f8ce42b662b74cd99a448fc6a95f9844498af (diff) | |
| parent | bfc71f610ee82768e35d06caef67925af27efe8e (diff) | |
Merge "Fix: java process gets included in native section of meminfo dump"
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 22928890e75a..7ef6032365d2 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -12532,6 +12532,13 @@ public class ActivityManagerService extends IActivityManager.Stub if (!brief && !opts.oomOnly && (procs.size() == 1 || opts.isCheckinRequest || opts.packages)) { opts.dumpDetails = true; } + final int numProcs = procs.size(); + final boolean collectNative = !opts.isCheckinRequest && numProcs > 1 && !opts.packages; + if (collectNative) { + // If we are showing aggregations, also look for native processes to + // include so that our aggregations are more accurate. + updateCpuStatsNow(); + } dumpApplicationMemoryUsageHeader(pw, uptime, realtime, opts.isCheckinRequest, opts.isCompact); @@ -12570,7 +12577,7 @@ public class ActivityManagerService extends IActivityManager.Stub boolean hasSwapPss = false; Debug.MemoryInfo mi = null; - for (int i = procs.size() - 1 ; i >= 0 ; i--) { + for (int i = numProcs - 1; i >= 0; i--) { final ProcessRecord r = procs.get(i); final IApplicationThread thread; final int pid; @@ -12724,10 +12731,7 @@ public class ActivityManagerService extends IActivityManager.Stub long nativeProcTotalPss = 0; - if (!opts.isCheckinRequest && procs.size() > 1 && !opts.packages) { - // If we are showing aggregations, also look for native processes to - // include so that our aggregations are more accurate. - updateCpuStatsNow(); + if (collectNative) { mi = null; synchronized (mProcessCpuTracker) { final int N = mProcessCpuTracker.countStats(); @@ -13095,6 +13099,13 @@ public class ActivityManagerService extends IActivityManager.Stub if (!brief && !opts.oomOnly && (procs.size() == 1 || opts.isCheckinRequest || opts.packages)) { opts.dumpDetails = true; } + final int numProcs = procs.size(); + final boolean collectNative = numProcs > 1 && !opts.packages; + if (collectNative) { + // If we are showing aggregations, also look for native processes to + // include so that our aggregations are more accurate. + updateCpuStatsNow(); + } ProtoOutputStream proto = new ProtoOutputStream(fd); @@ -13136,7 +13147,7 @@ public class ActivityManagerService extends IActivityManager.Stub boolean hasSwapPss = false; Debug.MemoryInfo mi = null; - for (int i = procs.size() - 1 ; i >= 0 ; i--) { + for (int i = numProcs - 1; i >= 0; i--) { final ProcessRecord r = procs.get(i); final IApplicationThread thread; final int pid; @@ -13283,10 +13294,7 @@ public class ActivityManagerService extends IActivityManager.Stub long nativeProcTotalPss = 0; - if (procs.size() > 1 && !opts.packages) { - // If we are showing aggregations, also look for native processes to - // include so that our aggregations are more accurate. - updateCpuStatsNow(); + if (collectNative) { mi = null; synchronized (mProcessCpuTracker) { final int N = mProcessCpuTracker.countStats(); |