Loading core/java/android/app/ActivityThread.java +8 −3 Original line number Diff line number Diff line Loading @@ -1544,11 +1544,12 @@ public final class ActivityThread extends ClientTransactionHandler @Override public void dumpMemInfo(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, boolean checkin, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, String[] args) { boolean dumpUnreachable, boolean dumpAllocatorStats, String[] args) { FileOutputStream fout = new FileOutputStream(pfd.getFileDescriptor()); PrintWriter pw = new FastPrintWriter(fout); try { dumpMemInfo(pw, mem, checkin, dumpFullInfo, dumpDalvik, dumpSummaryOnly, dumpUnreachable); dumpMemInfo(pw, mem, checkin, dumpFullInfo, dumpDalvik, dumpSummaryOnly, dumpUnreachable, dumpAllocatorStats); } finally { pw.flush(); IoUtils.closeQuietly(pfd); Loading @@ -1557,7 +1558,8 @@ public final class ActivityThread extends ClientTransactionHandler @NeverCompile private void dumpMemInfo(PrintWriter pw, Debug.MemoryInfo memInfo, boolean checkin, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable) { boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, boolean dumpAllocatorStats) { long nativeMax = Debug.getNativeHeapSize() / 1024; long nativeAllocated = Debug.getNativeHeapAllocatedSize() / 1024; long nativeFree = Debug.getNativeHeapFreeSize() / 1024; Loading Loading @@ -1710,6 +1712,9 @@ public final class ActivityThread extends ClientTransactionHandler pw.println(" Unreachable memory"); pw.print(Debug.getUnreachableMemory(100, showContents)); } if (dumpAllocatorStats) { Debug.logAllocatorStats(); } } @NeverCompile Loading core/java/android/app/IApplicationThread.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ oneway interface IApplicationThread { void scheduleTrimMemory(int level); void dumpMemInfo(in ParcelFileDescriptor fd, in Debug.MemoryInfo mem, boolean checkin, boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, in String[] args); boolean dumpAllocatorLogs, in String[] args); void dumpMemInfoProto(in ParcelFileDescriptor fd, in Debug.MemoryInfo mem, boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, in String[] args); Loading core/java/android/os/Debug.java +9 −0 Original line number Diff line number Diff line Loading @@ -2702,4 +2702,13 @@ public final class Debug * @hide */ public static native boolean isVmapStack(); /** * Log internal statistics about the allocator. * @return true if the statistics were logged properly, false if not. * * @hide */ public static native boolean logAllocatorStats(); } core/jni/android_os_Debug.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -1014,6 +1014,10 @@ static jboolean android_os_Debug_isVmapStack(JNIEnv *env, jobject clazz) return cfg_state == CONFIG_SET; } static jboolean android_os_Debug_logAllocatorStats(JNIEnv*, jobject) { return mallopt(M_LOG_STATS, 0) == 1 ? JNI_TRUE : JNI_FALSE; } /* * JNI registration. */ Loading Loading @@ -1056,6 +1060,7 @@ static const JNINativeMethod gMethods[] = { {"getDmabufHeapPoolsSizeKb", "()J", (void*)android_os_Debug_getDmabufHeapPoolsSizeKb}, {"getGpuTotalUsageKb", "()J", (void*)android_os_Debug_getGpuTotalUsageKb}, {"isVmapStack", "()Z", (void*)android_os_Debug_isVmapStack}, {"logAllocatorStats", "()Z", (void*)android_os_Debug_logAllocatorStats}, }; int register_android_os_Debug(JNIEnv *env) Loading services/core/java/com/android/server/am/ActivityManagerService.java +6 −2 Original line number Diff line number Diff line Loading @@ -11972,6 +11972,7 @@ public class ActivityManagerService extends IActivityManager.Stub boolean dumpSwapPss; boolean dumpProto; boolean mDumpPrivateDirty; boolean mDumpAllocatorStats; } @NeverCompile // Avoid size overhead of debugging code. Loading @@ -11991,6 +11992,7 @@ public class ActivityManagerService extends IActivityManager.Stub opts.dumpSwapPss = false; opts.dumpProto = asProto; opts.mDumpPrivateDirty = false; opts.mDumpAllocatorStats = false; int opti = 0; while (opti < args.length) { Loading Loading @@ -12027,7 +12029,8 @@ public class ActivityManagerService extends IActivityManager.Stub opts.isCheckinRequest = true; } else if ("--proto".equals(opt)) { opts.dumpProto = true; } else if ("--logstats".equals(opt)) { opts.mDumpAllocatorStats = true; } else if ("-h".equals(opt)) { pw.println("meminfo dump options: [-a] [-d] [-c] [-s] [--oom] [process]"); pw.println(" -a: include all available information for each process."); Loading Loading @@ -12238,7 +12241,8 @@ public class ActivityManagerService extends IActivityManager.Stub try { thread.dumpMemInfo(tp.getWriteFd(), mi, opts.isCheckinRequest, opts.dumpFullDetails, opts.dumpDalvik, opts.dumpSummaryOnly, opts.dumpUnreachable, innerArgs); opts.dumpDalvik, opts.dumpSummaryOnly, opts.dumpUnreachable, opts.mDumpAllocatorStats, innerArgs); tp.go(fd, opts.dumpUnreachable ? 30000 : 5000); } finally { tp.kill(); Loading
core/java/android/app/ActivityThread.java +8 −3 Original line number Diff line number Diff line Loading @@ -1544,11 +1544,12 @@ public final class ActivityThread extends ClientTransactionHandler @Override public void dumpMemInfo(ParcelFileDescriptor pfd, Debug.MemoryInfo mem, boolean checkin, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, String[] args) { boolean dumpUnreachable, boolean dumpAllocatorStats, String[] args) { FileOutputStream fout = new FileOutputStream(pfd.getFileDescriptor()); PrintWriter pw = new FastPrintWriter(fout); try { dumpMemInfo(pw, mem, checkin, dumpFullInfo, dumpDalvik, dumpSummaryOnly, dumpUnreachable); dumpMemInfo(pw, mem, checkin, dumpFullInfo, dumpDalvik, dumpSummaryOnly, dumpUnreachable, dumpAllocatorStats); } finally { pw.flush(); IoUtils.closeQuietly(pfd); Loading @@ -1557,7 +1558,8 @@ public final class ActivityThread extends ClientTransactionHandler @NeverCompile private void dumpMemInfo(PrintWriter pw, Debug.MemoryInfo memInfo, boolean checkin, boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable) { boolean dumpFullInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, boolean dumpAllocatorStats) { long nativeMax = Debug.getNativeHeapSize() / 1024; long nativeAllocated = Debug.getNativeHeapAllocatedSize() / 1024; long nativeFree = Debug.getNativeHeapFreeSize() / 1024; Loading Loading @@ -1710,6 +1712,9 @@ public final class ActivityThread extends ClientTransactionHandler pw.println(" Unreachable memory"); pw.print(Debug.getUnreachableMemory(100, showContents)); } if (dumpAllocatorStats) { Debug.logAllocatorStats(); } } @NeverCompile Loading
core/java/android/app/IApplicationThread.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ oneway interface IApplicationThread { void scheduleTrimMemory(int level); void dumpMemInfo(in ParcelFileDescriptor fd, in Debug.MemoryInfo mem, boolean checkin, boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, in String[] args); boolean dumpAllocatorLogs, in String[] args); void dumpMemInfoProto(in ParcelFileDescriptor fd, in Debug.MemoryInfo mem, boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, boolean dumpUnreachable, in String[] args); Loading
core/java/android/os/Debug.java +9 −0 Original line number Diff line number Diff line Loading @@ -2702,4 +2702,13 @@ public final class Debug * @hide */ public static native boolean isVmapStack(); /** * Log internal statistics about the allocator. * @return true if the statistics were logged properly, false if not. * * @hide */ public static native boolean logAllocatorStats(); }
core/jni/android_os_Debug.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -1014,6 +1014,10 @@ static jboolean android_os_Debug_isVmapStack(JNIEnv *env, jobject clazz) return cfg_state == CONFIG_SET; } static jboolean android_os_Debug_logAllocatorStats(JNIEnv*, jobject) { return mallopt(M_LOG_STATS, 0) == 1 ? JNI_TRUE : JNI_FALSE; } /* * JNI registration. */ Loading Loading @@ -1056,6 +1060,7 @@ static const JNINativeMethod gMethods[] = { {"getDmabufHeapPoolsSizeKb", "()J", (void*)android_os_Debug_getDmabufHeapPoolsSizeKb}, {"getGpuTotalUsageKb", "()J", (void*)android_os_Debug_getGpuTotalUsageKb}, {"isVmapStack", "()Z", (void*)android_os_Debug_isVmapStack}, {"logAllocatorStats", "()Z", (void*)android_os_Debug_logAllocatorStats}, }; int register_android_os_Debug(JNIEnv *env) Loading
services/core/java/com/android/server/am/ActivityManagerService.java +6 −2 Original line number Diff line number Diff line Loading @@ -11972,6 +11972,7 @@ public class ActivityManagerService extends IActivityManager.Stub boolean dumpSwapPss; boolean dumpProto; boolean mDumpPrivateDirty; boolean mDumpAllocatorStats; } @NeverCompile // Avoid size overhead of debugging code. Loading @@ -11991,6 +11992,7 @@ public class ActivityManagerService extends IActivityManager.Stub opts.dumpSwapPss = false; opts.dumpProto = asProto; opts.mDumpPrivateDirty = false; opts.mDumpAllocatorStats = false; int opti = 0; while (opti < args.length) { Loading Loading @@ -12027,7 +12029,8 @@ public class ActivityManagerService extends IActivityManager.Stub opts.isCheckinRequest = true; } else if ("--proto".equals(opt)) { opts.dumpProto = true; } else if ("--logstats".equals(opt)) { opts.mDumpAllocatorStats = true; } else if ("-h".equals(opt)) { pw.println("meminfo dump options: [-a] [-d] [-c] [-s] [--oom] [process]"); pw.println(" -a: include all available information for each process."); Loading Loading @@ -12238,7 +12241,8 @@ public class ActivityManagerService extends IActivityManager.Stub try { thread.dumpMemInfo(tp.getWriteFd(), mi, opts.isCheckinRequest, opts.dumpFullDetails, opts.dumpDalvik, opts.dumpSummaryOnly, opts.dumpUnreachable, innerArgs); opts.dumpDalvik, opts.dumpSummaryOnly, opts.dumpUnreachable, opts.mDumpAllocatorStats, innerArgs); tp.go(fd, opts.dumpUnreachable ? 30000 : 5000); } finally { tp.kill();