Loading core/java/android/app/ActivityThread.java +83 −52 Original line number Diff line number Diff line Loading @@ -2492,13 +2492,15 @@ public final class ActivityThread extends ClientTransactionHandler { } } private static final String HEAP_FULL_COLUMN = "%13s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s"; private static final String HEAP_COLUMN = "%13s %8s %8s %8s %8s %8s %8s %8s"; private static final String HEAP_FULL_COLUMN = "%13s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s"; private static final String HEAP_COLUMN = "%13s %8s %8s %8s %8s %8s %8s %8s %8s"; private static final String ONE_COUNT_COLUMN = "%21s %8d"; private static final String TWO_COUNT_COLUMNS = "%21s %8d %21s %8d"; private static final String ONE_COUNT_COLUMN_HEADER = "%21s %8s"; private static final String THREE_COUNT_COLUMNS = "%21s %8d %21s %8s %21s %8d"; private static final String TWO_COUNT_COLUMN_HEADER = "%21s %8s %21s %8s"; private static final String ONE_ALT_COUNT_COLUMN = "%21s %8s %21s %8d"; // Formatting for checkin service - update version if row format changes private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 4; Loading Loading @@ -2619,43 +2621,43 @@ public final class ActivityThread extends ClientTransactionHandler { if (dumpFullInfo) { printRow(pw, HEAP_FULL_COLUMN, "", "Pss", "Pss", "Shared", "Private", "Shared", "Private", memInfo.hasSwappedOutPss ? "SwapPss" : "Swap", "Heap", "Heap", "Heap"); "Rss", "Heap", "Heap", "Heap"); printRow(pw, HEAP_FULL_COLUMN, "", "Total", "Clean", "Dirty", "Dirty", "Clean", "Clean", "Dirty", "Clean", "Clean", "Dirty", "Total", "Size", "Alloc", "Free"); printRow(pw, HEAP_FULL_COLUMN, "", "------", "------", "------", "------", "------", "------", "------", "------", "------", "------"); "------", "------", "------", "------", "------", "------", "------"); printRow(pw, HEAP_FULL_COLUMN, "Native Heap", memInfo.nativePss, memInfo.nativeSwappablePss, memInfo.nativeSharedDirty, memInfo.nativePrivateDirty, memInfo.nativeSharedClean, memInfo.nativePrivateClean, memInfo.hasSwappedOutPss ? memInfo.nativeSwappedOutPss : memInfo.nativeSwappedOut, nativeMax, nativeAllocated, nativeFree); memInfo.nativeRss, nativeMax, nativeAllocated, nativeFree); printRow(pw, HEAP_FULL_COLUMN, "Dalvik Heap", memInfo.dalvikPss, memInfo.dalvikSwappablePss, memInfo.dalvikSharedDirty, memInfo.dalvikPrivateDirty, memInfo.dalvikSharedClean, memInfo.dalvikPrivateClean, memInfo.hasSwappedOutPss ? memInfo.dalvikSwappedOutPss : memInfo.dalvikSwappedOut, dalvikMax, dalvikAllocated, dalvikFree); memInfo.dalvikRss, dalvikMax, dalvikAllocated, dalvikFree); } else { printRow(pw, HEAP_COLUMN, "", "Pss", "Private", "Private", memInfo.hasSwappedOutPss ? "SwapPss" : "Swap", "Heap", "Heap", "Heap"); "Rss", "Heap", "Heap", "Heap"); printRow(pw, HEAP_COLUMN, "", "Total", "Dirty", "Clean", "Dirty", "Size", "Alloc", "Free"); "Clean", "Dirty", "Total", "Size", "Alloc", "Free"); printRow(pw, HEAP_COLUMN, "", "------", "------", "------", "------", "------", "------", "------", "------"); "------", "------", "------", "------", "------", "------"); printRow(pw, HEAP_COLUMN, "Native Heap", memInfo.nativePss, memInfo.nativePrivateDirty, memInfo.nativePrivateClean, memInfo.hasSwappedOutPss ? memInfo.nativeSwappedOutPss : memInfo.nativeSwappedOut, memInfo.nativeSwappedOut, memInfo.nativeRss, nativeMax, nativeAllocated, nativeFree); printRow(pw, HEAP_COLUMN, "Dalvik Heap", memInfo.dalvikPss, memInfo.dalvikPrivateDirty, memInfo.dalvikPrivateClean, memInfo.hasSwappedOutPss ? memInfo.dalvikSwappedOutPss : memInfo.dalvikSwappedOut, memInfo.dalvikSwappedOut, memInfo.dalvikRss, dalvikMax, dalvikAllocated, dalvikFree); } Loading @@ -2667,6 +2669,7 @@ public final class ActivityThread extends ClientTransactionHandler { int otherPrivateClean = memInfo.otherPrivateClean; int otherSwappedOut = memInfo.otherSwappedOut; int otherSwappedOutPss = memInfo.otherSwappedOutPss; int otherRss = memInfo.otherRss; for (int i=0; i<Debug.MemoryInfo.NUM_OTHER_STATS; i++) { final int myPss = memInfo.getOtherPss(i); Loading @@ -2677,21 +2680,22 @@ public final class ActivityThread extends ClientTransactionHandler { final int myPrivateClean = memInfo.getOtherPrivateClean(i); final int mySwappedOut = memInfo.getOtherSwappedOut(i); final int mySwappedOutPss = memInfo.getOtherSwappedOutPss(i); final int myRss = memInfo.getOtherRss(i); if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 || mySharedClean != 0 || myPrivateClean != 0 || mySharedClean != 0 || myPrivateClean != 0 || myRss != 0 || (memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut) != 0) { if (dumpFullInfo) { printRow(pw, HEAP_FULL_COLUMN, Debug.MemoryInfo.getOtherLabel(i), myPss, mySwappablePss, mySharedDirty, myPrivateDirty, mySharedClean, myPrivateClean, memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut, "", "", ""); myRss, "", "", ""); } else { printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i), myPss, myPrivateDirty, myPrivateClean, memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut, "", "", ""); myRss, "", "", ""); } otherPss -= myPss; otherSwappablePss -= mySwappablePss; Loading @@ -2701,6 +2705,7 @@ public final class ActivityThread extends ClientTransactionHandler { otherPrivateClean -= myPrivateClean; otherSwappedOut -= mySwappedOut; otherSwappedOutPss -= mySwappedOutPss; otherRss -= myRss; } } Loading @@ -2708,25 +2713,25 @@ public final class ActivityThread extends ClientTransactionHandler { printRow(pw, HEAP_FULL_COLUMN, "Unknown", otherPss, otherSwappablePss, otherSharedDirty, otherPrivateDirty, otherSharedClean, otherPrivateClean, memInfo.hasSwappedOutPss ? otherSwappedOutPss : otherSwappedOut, "", "", ""); otherRss, "", "", ""); printRow(pw, HEAP_FULL_COLUMN, "TOTAL", memInfo.getTotalPss(), memInfo.getTotalSwappablePss(), memInfo.getTotalSharedDirty(), memInfo.getTotalPrivateDirty(), memInfo.getTotalSharedClean(), memInfo.getTotalPrivateClean(), memInfo.hasSwappedOutPss ? memInfo.getTotalSwappedOutPss() : memInfo.getTotalSwappedOut(), memInfo.getTotalSwappedOut(), memInfo.getTotalRss(), nativeMax+dalvikMax, nativeAllocated+dalvikAllocated, nativeFree+dalvikFree); } else { printRow(pw, HEAP_COLUMN, "Unknown", otherPss, otherPrivateDirty, otherPrivateClean, memInfo.hasSwappedOutPss ? otherSwappedOutPss : otherSwappedOut, "", "", ""); otherRss, "", "", ""); printRow(pw, HEAP_COLUMN, "TOTAL", memInfo.getTotalPss(), memInfo.getTotalPrivateDirty(), memInfo.getTotalPrivateClean(), memInfo.hasSwappedOutPss ? memInfo.getTotalSwappedOutPss() : memInfo.getTotalSwappedOut(), memInfo.getTotalSwappedOut(), memInfo.getTotalPss(), nativeMax+dalvikMax, nativeAllocated+dalvikAllocated, nativeFree+dalvikFree); } Loading @@ -2745,6 +2750,7 @@ public final class ActivityThread extends ClientTransactionHandler { final int myPrivateClean = memInfo.getOtherPrivateClean(i); final int mySwappedOut = memInfo.getOtherSwappedOut(i); final int mySwappedOutPss = memInfo.getOtherSwappedOutPss(i); final int myRss = memInfo.getOtherRss(i); if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 || mySharedClean != 0 || myPrivateClean != 0 || (memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut) != 0) { Loading @@ -2753,13 +2759,13 @@ public final class ActivityThread extends ClientTransactionHandler { myPss, mySwappablePss, mySharedDirty, myPrivateDirty, mySharedClean, myPrivateClean, memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut, "", "", ""); myRss, "", "", ""); } else { printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i), myPss, myPrivateDirty, myPrivateClean, memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut, "", "", ""); myRss, "", "", ""); } } } Loading @@ -2768,30 +2774,35 @@ public final class ActivityThread extends ClientTransactionHandler { pw.println(" "); pw.println(" App Summary"); printRow(pw, ONE_COUNT_COLUMN_HEADER, "", "Pss(KB)"); printRow(pw, ONE_COUNT_COLUMN_HEADER, "", "------"); printRow(pw, ONE_COUNT_COLUMN, "Java Heap:", memInfo.getSummaryJavaHeap()); printRow(pw, ONE_COUNT_COLUMN, "Native Heap:", memInfo.getSummaryNativeHeap()); printRow(pw, ONE_COUNT_COLUMN, "Code:", memInfo.getSummaryCode()); printRow(pw, ONE_COUNT_COLUMN, "Stack:", memInfo.getSummaryStack()); printRow(pw, ONE_COUNT_COLUMN, "Graphics:", memInfo.getSummaryGraphics()); printRow(pw, TWO_COUNT_COLUMN_HEADER, "", "Pss(KB)", "", "Rss(KB)"); printRow(pw, TWO_COUNT_COLUMN_HEADER, "", "------", "", "------"); printRow(pw, TWO_COUNT_COLUMNS, "Java Heap:", memInfo.getSummaryJavaHeap(), "", memInfo.getSummaryJavaHeapRss()); printRow(pw, TWO_COUNT_COLUMNS, "Native Heap:", memInfo.getSummaryNativeHeap(), "", memInfo.getSummaryNativeHeapRss()); printRow(pw, TWO_COUNT_COLUMNS, "Code:", memInfo.getSummaryCode(), "", memInfo.getSummaryCodeRss()); printRow(pw, TWO_COUNT_COLUMNS, "Stack:", memInfo.getSummaryStack(), "", memInfo.getSummaryStackRss()); printRow(pw, TWO_COUNT_COLUMNS, "Graphics:", memInfo.getSummaryGraphics(), "", memInfo.getSummaryGraphicsRss()); printRow(pw, ONE_COUNT_COLUMN, "Private Other:", memInfo.getSummaryPrivateOther()); printRow(pw, ONE_COUNT_COLUMN, "System:", memInfo.getSummarySystem()); printRow(pw, ONE_ALT_COUNT_COLUMN, "Unknown:", "", "", memInfo.getSummaryUnknownRss()); pw.println(" "); if (memInfo.hasSwappedOutPss) { printRow(pw, TWO_COUNT_COLUMNS, "TOTAL:", memInfo.getSummaryTotalPss(), printRow(pw, THREE_COUNT_COLUMNS, "TOTAL PSS:", memInfo.getSummaryTotalPss(), "TOTAL RSS:", memInfo.getTotalRss(), "TOTAL SWAP PSS:", memInfo.getSummaryTotalSwapPss()); } else { printRow(pw, TWO_COUNT_COLUMNS, "TOTAL:", memInfo.getSummaryTotalPss(), printRow(pw, THREE_COUNT_COLUMNS, "TOTAL PSS:", memInfo.getSummaryTotalPss(), "TOTAL RSS:", memInfo.getTotalRss(), "TOTAL SWAP (KB):", memInfo.getSummaryTotalSwap()); } } Loading @@ -2804,7 +2815,7 @@ public final class ActivityThread extends ClientTransactionHandler { private static void dumpMemoryInfo(ProtoOutputStream proto, long fieldId, String name, int pss, int cleanPss, int sharedDirty, int privateDirty, int sharedClean, int privateClean, boolean hasSwappedOutPss, int dirtySwap, int dirtySwapPss) { boolean hasSwappedOutPss, int dirtySwap, int dirtySwapPss, int rss) { final long token = proto.start(fieldId); proto.write(MemInfoDumpProto.ProcessMemory.MemoryInfo.NAME, name); Loading @@ -2819,6 +2830,7 @@ public final class ActivityThread extends ClientTransactionHandler { } else { proto.write(MemInfoDumpProto.ProcessMemory.MemoryInfo.DIRTY_SWAP_KB, dirtySwap); } proto.write(MemInfoDumpProto.ProcessMemory.MemoryInfo.TOTAL_RSS_KB, rss); proto.end(token); } Loading @@ -2837,7 +2849,8 @@ public final class ActivityThread extends ClientTransactionHandler { memInfo.nativePss, memInfo.nativeSwappablePss, memInfo.nativeSharedDirty, memInfo.nativePrivateDirty, memInfo.nativeSharedClean, memInfo.nativePrivateClean, memInfo.hasSwappedOutPss, memInfo.nativeSwappedOut, memInfo.nativeSwappedOutPss); memInfo.nativeSwappedOut, memInfo.nativeSwappedOutPss, memInfo.nativeRss); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_SIZE_KB, nativeMax); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_ALLOC_KB, nativeAllocated); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_FREE_KB, nativeFree); Loading @@ -2848,7 +2861,8 @@ public final class ActivityThread extends ClientTransactionHandler { memInfo.dalvikPss, memInfo.dalvikSwappablePss, memInfo.dalvikSharedDirty, memInfo.dalvikPrivateDirty, memInfo.dalvikSharedClean, memInfo.dalvikPrivateClean, memInfo.hasSwappedOutPss, memInfo.dalvikSwappedOut, memInfo.dalvikSwappedOutPss); memInfo.dalvikSwappedOut, memInfo.dalvikSwappedOutPss, memInfo.dalvikRss); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_SIZE_KB, dalvikMax); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_ALLOC_KB, dalvikAllocated); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_FREE_KB, dalvikFree); Loading @@ -2862,6 +2876,7 @@ public final class ActivityThread extends ClientTransactionHandler { int otherPrivateClean = memInfo.otherPrivateClean; int otherSwappedOut = memInfo.otherSwappedOut; int otherSwappedOutPss = memInfo.otherSwappedOutPss; int otherRss = memInfo.otherRss; for (int i = 0; i < Debug.MemoryInfo.NUM_OTHER_STATS; i++) { final int myPss = memInfo.getOtherPss(i); Loading @@ -2872,14 +2887,15 @@ public final class ActivityThread extends ClientTransactionHandler { final int myPrivateClean = memInfo.getOtherPrivateClean(i); final int mySwappedOut = memInfo.getOtherSwappedOut(i); final int mySwappedOutPss = memInfo.getOtherSwappedOutPss(i); final int myRss = memInfo.getOtherRss(i); if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 || mySharedClean != 0 || myPrivateClean != 0 || mySharedClean != 0 || myPrivateClean != 0 || myRss != 0 || (memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut) != 0) { dumpMemoryInfo(proto, MemInfoDumpProto.ProcessMemory.OTHER_HEAPS, Debug.MemoryInfo.getOtherLabel(i), myPss, mySwappablePss, mySharedDirty, myPrivateDirty, mySharedClean, myPrivateClean, memInfo.hasSwappedOutPss, mySwappedOut, mySwappedOutPss); memInfo.hasSwappedOutPss, mySwappedOut, mySwappedOutPss, myRss); otherPss -= myPss; otherSwappablePss -= mySwappablePss; Loading @@ -2889,20 +2905,21 @@ public final class ActivityThread extends ClientTransactionHandler { otherPrivateClean -= myPrivateClean; otherSwappedOut -= mySwappedOut; otherSwappedOutPss -= mySwappedOutPss; otherRss -= myRss; } } dumpMemoryInfo(proto, MemInfoDumpProto.ProcessMemory.UNKNOWN_HEAP, "Unknown", otherPss, otherSwappablePss, otherSharedDirty, otherPrivateDirty, otherSharedClean, otherPrivateClean, memInfo.hasSwappedOutPss, otherSwappedOut, otherSwappedOutPss); memInfo.hasSwappedOutPss, otherSwappedOut, otherSwappedOutPss, otherRss); final long tToken = proto.start(MemInfoDumpProto.ProcessMemory.TOTAL_HEAP); dumpMemoryInfo(proto, MemInfoDumpProto.ProcessMemory.HeapInfo.MEM_INFO, "TOTAL", memInfo.getTotalPss(), memInfo.getTotalSwappablePss(), memInfo.getTotalSharedDirty(), memInfo.getTotalPrivateDirty(), memInfo.getTotalSharedClean(), memInfo.getTotalPrivateClean(), memInfo.hasSwappedOutPss, memInfo.getTotalSwappedOut(), memInfo.getTotalSwappedOutPss()); memInfo.getTotalSwappedOutPss(), memInfo.getTotalRss()); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_SIZE_KB, nativeMax + dalvikMax); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_ALLOC_KB, Loading @@ -2923,6 +2940,7 @@ public final class ActivityThread extends ClientTransactionHandler { final int myPrivateClean = memInfo.getOtherPrivateClean(i); final int mySwappedOut = memInfo.getOtherSwappedOut(i); final int mySwappedOutPss = memInfo.getOtherSwappedOutPss(i); final int myRss = memInfo.getOtherRss(i); if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 || mySharedClean != 0 || myPrivateClean != 0 || (memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut) != 0) { Loading @@ -2930,7 +2948,7 @@ public final class ActivityThread extends ClientTransactionHandler { Debug.MemoryInfo.getOtherLabel(i), myPss, mySwappablePss, mySharedDirty, myPrivateDirty, mySharedClean, myPrivateClean, memInfo.hasSwappedOutPss, mySwappedOut, mySwappedOutPss); memInfo.hasSwappedOutPss, mySwappedOut, mySwappedOutPss, myRss); } } } Loading Loading @@ -2958,6 +2976,19 @@ public final class ActivityThread extends ClientTransactionHandler { proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.TOTAL_SWAP_PSS, memInfo.getSummaryTotalSwap()); } proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.JAVA_HEAP_RSS_KB, memInfo.getSummaryJavaHeapRss()); proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.NATIVE_HEAP_RSS_KB, memInfo.getSummaryNativeHeapRss()); proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.CODE_RSS_KB, memInfo.getSummaryCodeRss()); proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.STACK_RSS_KB, memInfo.getSummaryStackRss()); proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.GRAPHICS_RSS_KB, memInfo.getSummaryGraphicsRss()); proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.UNKNOWN_RSS_KB, memInfo.getSummaryUnknownRss()); proto.end(asToken); } Loading core/java/android/os/Debug.java +62 −0 Original line number Diff line number Diff line Loading @@ -786,6 +786,68 @@ public final class Debug - getTotalPrivateDirty(); } /** * Rss of Java Heap bytes in KB due to the application. * @hide */ public int getSummaryJavaHeapRss() { return dalvikRss + getOtherRss(OTHER_ART); } /** * Rss of Native Heap bytes in KB due to the application. * @hide */ public int getSummaryNativeHeapRss() { return nativeRss; } /** * Rss of code and other static resource bytes in KB due to * the application. * @hide */ public int getSummaryCodeRss() { return getOtherRss(OTHER_SO) + getOtherRss(OTHER_JAR) + getOtherRss(OTHER_APK) + getOtherRss(OTHER_TTF) + getOtherRss(OTHER_DEX) + getOtherRss(OTHER_OAT); } /** * Rss in KB of the stack due to the application. * @hide */ public int getSummaryStackRss() { return getOtherRss(OTHER_STACK); } /** * Rss in KB of graphics due to the application. * @hide */ public int getSummaryGraphicsRss() { return getOtherRss(OTHER_GL_DEV) + getOtherRss(OTHER_GRAPHICS) + getOtherRss(OTHER_GL); } /** * Rss in KB due to either the application or system that haven't otherwise been * accounted for. * @hide */ public int getSummaryUnknownRss() { return getTotalRss() - getSummaryJavaHeapRss() - getSummaryNativeHeapRss() - getSummaryCodeRss() - getSummaryStackRss() - getSummaryGraphicsRss(); } /** * Total Pss in KB. * @hide Loading core/proto/android/server/activitymanagerservice.proto +17 −1 Original line number Diff line number Diff line Loading @@ -261,6 +261,8 @@ message MemInfoDumpProto { // The dirty the pages that have been swapped out, proportional. int32 dirty_swap_pss_kb = 9; } // The rss set size for the heap. optional int32 total_rss_kb = 10; } message HeapInfo { option (.android.msg_privacy).dest = DEST_AUTOMATIC; Loading Loading @@ -294,6 +296,12 @@ message MemInfoDumpProto { int32 total_swap_pss = 8; int32 total_swap_kb = 9; } optional int32 java_heap_rss_kb = 10; optional int32 native_heap_rss_kb = 11; optional int32 code_rss_kb = 12; optional int32 stack_rss_kb = 13; optional int32 graphics_rss_kb = 14; optional int32 unknown_rss_kb = 15; } optional AppSummary app_summary = 9; } Loading Loading @@ -359,10 +367,16 @@ message MemInfoDumpProto { optional int32 id = 3; optional bool is_proc = 4; optional bool has_activities = 5; optional int64 pss_kb = 6; oneof ss_kb { int64 pss_kb = 6; int64 rss_kb = 9; } optional int64 swap_pss_kb = 7; repeated MemItem sub_items = 8; } repeated MemItem total_rss_by_process = 29; repeated MemItem total_rss_by_oom_adjustment = 30; repeated MemItem total_rss_by_category = 31; repeated MemItem total_pss_by_process = 5; repeated MemItem total_pss_by_oom_adjustment = 6; repeated MemItem total_pss_by_category = 7; Loading Loading @@ -414,6 +428,8 @@ message MemInfoDumpProto { optional bool is_low_ram_device = 27; optional bool is_high_end_gfx = 28; // Next Tag: 32 } message StickyBroadcastProto { Loading services/core/java/com/android/server/am/ActivityManagerService.java +163 −54 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
core/java/android/app/ActivityThread.java +83 −52 Original line number Diff line number Diff line Loading @@ -2492,13 +2492,15 @@ public final class ActivityThread extends ClientTransactionHandler { } } private static final String HEAP_FULL_COLUMN = "%13s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s"; private static final String HEAP_COLUMN = "%13s %8s %8s %8s %8s %8s %8s %8s"; private static final String HEAP_FULL_COLUMN = "%13s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s"; private static final String HEAP_COLUMN = "%13s %8s %8s %8s %8s %8s %8s %8s %8s"; private static final String ONE_COUNT_COLUMN = "%21s %8d"; private static final String TWO_COUNT_COLUMNS = "%21s %8d %21s %8d"; private static final String ONE_COUNT_COLUMN_HEADER = "%21s %8s"; private static final String THREE_COUNT_COLUMNS = "%21s %8d %21s %8s %21s %8d"; private static final String TWO_COUNT_COLUMN_HEADER = "%21s %8s %21s %8s"; private static final String ONE_ALT_COUNT_COLUMN = "%21s %8s %21s %8d"; // Formatting for checkin service - update version if row format changes private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 4; Loading Loading @@ -2619,43 +2621,43 @@ public final class ActivityThread extends ClientTransactionHandler { if (dumpFullInfo) { printRow(pw, HEAP_FULL_COLUMN, "", "Pss", "Pss", "Shared", "Private", "Shared", "Private", memInfo.hasSwappedOutPss ? "SwapPss" : "Swap", "Heap", "Heap", "Heap"); "Rss", "Heap", "Heap", "Heap"); printRow(pw, HEAP_FULL_COLUMN, "", "Total", "Clean", "Dirty", "Dirty", "Clean", "Clean", "Dirty", "Clean", "Clean", "Dirty", "Total", "Size", "Alloc", "Free"); printRow(pw, HEAP_FULL_COLUMN, "", "------", "------", "------", "------", "------", "------", "------", "------", "------", "------"); "------", "------", "------", "------", "------", "------", "------"); printRow(pw, HEAP_FULL_COLUMN, "Native Heap", memInfo.nativePss, memInfo.nativeSwappablePss, memInfo.nativeSharedDirty, memInfo.nativePrivateDirty, memInfo.nativeSharedClean, memInfo.nativePrivateClean, memInfo.hasSwappedOutPss ? memInfo.nativeSwappedOutPss : memInfo.nativeSwappedOut, nativeMax, nativeAllocated, nativeFree); memInfo.nativeRss, nativeMax, nativeAllocated, nativeFree); printRow(pw, HEAP_FULL_COLUMN, "Dalvik Heap", memInfo.dalvikPss, memInfo.dalvikSwappablePss, memInfo.dalvikSharedDirty, memInfo.dalvikPrivateDirty, memInfo.dalvikSharedClean, memInfo.dalvikPrivateClean, memInfo.hasSwappedOutPss ? memInfo.dalvikSwappedOutPss : memInfo.dalvikSwappedOut, dalvikMax, dalvikAllocated, dalvikFree); memInfo.dalvikRss, dalvikMax, dalvikAllocated, dalvikFree); } else { printRow(pw, HEAP_COLUMN, "", "Pss", "Private", "Private", memInfo.hasSwappedOutPss ? "SwapPss" : "Swap", "Heap", "Heap", "Heap"); "Rss", "Heap", "Heap", "Heap"); printRow(pw, HEAP_COLUMN, "", "Total", "Dirty", "Clean", "Dirty", "Size", "Alloc", "Free"); "Clean", "Dirty", "Total", "Size", "Alloc", "Free"); printRow(pw, HEAP_COLUMN, "", "------", "------", "------", "------", "------", "------", "------", "------"); "------", "------", "------", "------", "------", "------"); printRow(pw, HEAP_COLUMN, "Native Heap", memInfo.nativePss, memInfo.nativePrivateDirty, memInfo.nativePrivateClean, memInfo.hasSwappedOutPss ? memInfo.nativeSwappedOutPss : memInfo.nativeSwappedOut, memInfo.nativeSwappedOut, memInfo.nativeRss, nativeMax, nativeAllocated, nativeFree); printRow(pw, HEAP_COLUMN, "Dalvik Heap", memInfo.dalvikPss, memInfo.dalvikPrivateDirty, memInfo.dalvikPrivateClean, memInfo.hasSwappedOutPss ? memInfo.dalvikSwappedOutPss : memInfo.dalvikSwappedOut, memInfo.dalvikSwappedOut, memInfo.dalvikRss, dalvikMax, dalvikAllocated, dalvikFree); } Loading @@ -2667,6 +2669,7 @@ public final class ActivityThread extends ClientTransactionHandler { int otherPrivateClean = memInfo.otherPrivateClean; int otherSwappedOut = memInfo.otherSwappedOut; int otherSwappedOutPss = memInfo.otherSwappedOutPss; int otherRss = memInfo.otherRss; for (int i=0; i<Debug.MemoryInfo.NUM_OTHER_STATS; i++) { final int myPss = memInfo.getOtherPss(i); Loading @@ -2677,21 +2680,22 @@ public final class ActivityThread extends ClientTransactionHandler { final int myPrivateClean = memInfo.getOtherPrivateClean(i); final int mySwappedOut = memInfo.getOtherSwappedOut(i); final int mySwappedOutPss = memInfo.getOtherSwappedOutPss(i); final int myRss = memInfo.getOtherRss(i); if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 || mySharedClean != 0 || myPrivateClean != 0 || mySharedClean != 0 || myPrivateClean != 0 || myRss != 0 || (memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut) != 0) { if (dumpFullInfo) { printRow(pw, HEAP_FULL_COLUMN, Debug.MemoryInfo.getOtherLabel(i), myPss, mySwappablePss, mySharedDirty, myPrivateDirty, mySharedClean, myPrivateClean, memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut, "", "", ""); myRss, "", "", ""); } else { printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i), myPss, myPrivateDirty, myPrivateClean, memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut, "", "", ""); myRss, "", "", ""); } otherPss -= myPss; otherSwappablePss -= mySwappablePss; Loading @@ -2701,6 +2705,7 @@ public final class ActivityThread extends ClientTransactionHandler { otherPrivateClean -= myPrivateClean; otherSwappedOut -= mySwappedOut; otherSwappedOutPss -= mySwappedOutPss; otherRss -= myRss; } } Loading @@ -2708,25 +2713,25 @@ public final class ActivityThread extends ClientTransactionHandler { printRow(pw, HEAP_FULL_COLUMN, "Unknown", otherPss, otherSwappablePss, otherSharedDirty, otherPrivateDirty, otherSharedClean, otherPrivateClean, memInfo.hasSwappedOutPss ? otherSwappedOutPss : otherSwappedOut, "", "", ""); otherRss, "", "", ""); printRow(pw, HEAP_FULL_COLUMN, "TOTAL", memInfo.getTotalPss(), memInfo.getTotalSwappablePss(), memInfo.getTotalSharedDirty(), memInfo.getTotalPrivateDirty(), memInfo.getTotalSharedClean(), memInfo.getTotalPrivateClean(), memInfo.hasSwappedOutPss ? memInfo.getTotalSwappedOutPss() : memInfo.getTotalSwappedOut(), memInfo.getTotalSwappedOut(), memInfo.getTotalRss(), nativeMax+dalvikMax, nativeAllocated+dalvikAllocated, nativeFree+dalvikFree); } else { printRow(pw, HEAP_COLUMN, "Unknown", otherPss, otherPrivateDirty, otherPrivateClean, memInfo.hasSwappedOutPss ? otherSwappedOutPss : otherSwappedOut, "", "", ""); otherRss, "", "", ""); printRow(pw, HEAP_COLUMN, "TOTAL", memInfo.getTotalPss(), memInfo.getTotalPrivateDirty(), memInfo.getTotalPrivateClean(), memInfo.hasSwappedOutPss ? memInfo.getTotalSwappedOutPss() : memInfo.getTotalSwappedOut(), memInfo.getTotalSwappedOut(), memInfo.getTotalPss(), nativeMax+dalvikMax, nativeAllocated+dalvikAllocated, nativeFree+dalvikFree); } Loading @@ -2745,6 +2750,7 @@ public final class ActivityThread extends ClientTransactionHandler { final int myPrivateClean = memInfo.getOtherPrivateClean(i); final int mySwappedOut = memInfo.getOtherSwappedOut(i); final int mySwappedOutPss = memInfo.getOtherSwappedOutPss(i); final int myRss = memInfo.getOtherRss(i); if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 || mySharedClean != 0 || myPrivateClean != 0 || (memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut) != 0) { Loading @@ -2753,13 +2759,13 @@ public final class ActivityThread extends ClientTransactionHandler { myPss, mySwappablePss, mySharedDirty, myPrivateDirty, mySharedClean, myPrivateClean, memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut, "", "", ""); myRss, "", "", ""); } else { printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i), myPss, myPrivateDirty, myPrivateClean, memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut, "", "", ""); myRss, "", "", ""); } } } Loading @@ -2768,30 +2774,35 @@ public final class ActivityThread extends ClientTransactionHandler { pw.println(" "); pw.println(" App Summary"); printRow(pw, ONE_COUNT_COLUMN_HEADER, "", "Pss(KB)"); printRow(pw, ONE_COUNT_COLUMN_HEADER, "", "------"); printRow(pw, ONE_COUNT_COLUMN, "Java Heap:", memInfo.getSummaryJavaHeap()); printRow(pw, ONE_COUNT_COLUMN, "Native Heap:", memInfo.getSummaryNativeHeap()); printRow(pw, ONE_COUNT_COLUMN, "Code:", memInfo.getSummaryCode()); printRow(pw, ONE_COUNT_COLUMN, "Stack:", memInfo.getSummaryStack()); printRow(pw, ONE_COUNT_COLUMN, "Graphics:", memInfo.getSummaryGraphics()); printRow(pw, TWO_COUNT_COLUMN_HEADER, "", "Pss(KB)", "", "Rss(KB)"); printRow(pw, TWO_COUNT_COLUMN_HEADER, "", "------", "", "------"); printRow(pw, TWO_COUNT_COLUMNS, "Java Heap:", memInfo.getSummaryJavaHeap(), "", memInfo.getSummaryJavaHeapRss()); printRow(pw, TWO_COUNT_COLUMNS, "Native Heap:", memInfo.getSummaryNativeHeap(), "", memInfo.getSummaryNativeHeapRss()); printRow(pw, TWO_COUNT_COLUMNS, "Code:", memInfo.getSummaryCode(), "", memInfo.getSummaryCodeRss()); printRow(pw, TWO_COUNT_COLUMNS, "Stack:", memInfo.getSummaryStack(), "", memInfo.getSummaryStackRss()); printRow(pw, TWO_COUNT_COLUMNS, "Graphics:", memInfo.getSummaryGraphics(), "", memInfo.getSummaryGraphicsRss()); printRow(pw, ONE_COUNT_COLUMN, "Private Other:", memInfo.getSummaryPrivateOther()); printRow(pw, ONE_COUNT_COLUMN, "System:", memInfo.getSummarySystem()); printRow(pw, ONE_ALT_COUNT_COLUMN, "Unknown:", "", "", memInfo.getSummaryUnknownRss()); pw.println(" "); if (memInfo.hasSwappedOutPss) { printRow(pw, TWO_COUNT_COLUMNS, "TOTAL:", memInfo.getSummaryTotalPss(), printRow(pw, THREE_COUNT_COLUMNS, "TOTAL PSS:", memInfo.getSummaryTotalPss(), "TOTAL RSS:", memInfo.getTotalRss(), "TOTAL SWAP PSS:", memInfo.getSummaryTotalSwapPss()); } else { printRow(pw, TWO_COUNT_COLUMNS, "TOTAL:", memInfo.getSummaryTotalPss(), printRow(pw, THREE_COUNT_COLUMNS, "TOTAL PSS:", memInfo.getSummaryTotalPss(), "TOTAL RSS:", memInfo.getTotalRss(), "TOTAL SWAP (KB):", memInfo.getSummaryTotalSwap()); } } Loading @@ -2804,7 +2815,7 @@ public final class ActivityThread extends ClientTransactionHandler { private static void dumpMemoryInfo(ProtoOutputStream proto, long fieldId, String name, int pss, int cleanPss, int sharedDirty, int privateDirty, int sharedClean, int privateClean, boolean hasSwappedOutPss, int dirtySwap, int dirtySwapPss) { boolean hasSwappedOutPss, int dirtySwap, int dirtySwapPss, int rss) { final long token = proto.start(fieldId); proto.write(MemInfoDumpProto.ProcessMemory.MemoryInfo.NAME, name); Loading @@ -2819,6 +2830,7 @@ public final class ActivityThread extends ClientTransactionHandler { } else { proto.write(MemInfoDumpProto.ProcessMemory.MemoryInfo.DIRTY_SWAP_KB, dirtySwap); } proto.write(MemInfoDumpProto.ProcessMemory.MemoryInfo.TOTAL_RSS_KB, rss); proto.end(token); } Loading @@ -2837,7 +2849,8 @@ public final class ActivityThread extends ClientTransactionHandler { memInfo.nativePss, memInfo.nativeSwappablePss, memInfo.nativeSharedDirty, memInfo.nativePrivateDirty, memInfo.nativeSharedClean, memInfo.nativePrivateClean, memInfo.hasSwappedOutPss, memInfo.nativeSwappedOut, memInfo.nativeSwappedOutPss); memInfo.nativeSwappedOut, memInfo.nativeSwappedOutPss, memInfo.nativeRss); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_SIZE_KB, nativeMax); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_ALLOC_KB, nativeAllocated); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_FREE_KB, nativeFree); Loading @@ -2848,7 +2861,8 @@ public final class ActivityThread extends ClientTransactionHandler { memInfo.dalvikPss, memInfo.dalvikSwappablePss, memInfo.dalvikSharedDirty, memInfo.dalvikPrivateDirty, memInfo.dalvikSharedClean, memInfo.dalvikPrivateClean, memInfo.hasSwappedOutPss, memInfo.dalvikSwappedOut, memInfo.dalvikSwappedOutPss); memInfo.dalvikSwappedOut, memInfo.dalvikSwappedOutPss, memInfo.dalvikRss); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_SIZE_KB, dalvikMax); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_ALLOC_KB, dalvikAllocated); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_FREE_KB, dalvikFree); Loading @@ -2862,6 +2876,7 @@ public final class ActivityThread extends ClientTransactionHandler { int otherPrivateClean = memInfo.otherPrivateClean; int otherSwappedOut = memInfo.otherSwappedOut; int otherSwappedOutPss = memInfo.otherSwappedOutPss; int otherRss = memInfo.otherRss; for (int i = 0; i < Debug.MemoryInfo.NUM_OTHER_STATS; i++) { final int myPss = memInfo.getOtherPss(i); Loading @@ -2872,14 +2887,15 @@ public final class ActivityThread extends ClientTransactionHandler { final int myPrivateClean = memInfo.getOtherPrivateClean(i); final int mySwappedOut = memInfo.getOtherSwappedOut(i); final int mySwappedOutPss = memInfo.getOtherSwappedOutPss(i); final int myRss = memInfo.getOtherRss(i); if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 || mySharedClean != 0 || myPrivateClean != 0 || mySharedClean != 0 || myPrivateClean != 0 || myRss != 0 || (memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut) != 0) { dumpMemoryInfo(proto, MemInfoDumpProto.ProcessMemory.OTHER_HEAPS, Debug.MemoryInfo.getOtherLabel(i), myPss, mySwappablePss, mySharedDirty, myPrivateDirty, mySharedClean, myPrivateClean, memInfo.hasSwappedOutPss, mySwappedOut, mySwappedOutPss); memInfo.hasSwappedOutPss, mySwappedOut, mySwappedOutPss, myRss); otherPss -= myPss; otherSwappablePss -= mySwappablePss; Loading @@ -2889,20 +2905,21 @@ public final class ActivityThread extends ClientTransactionHandler { otherPrivateClean -= myPrivateClean; otherSwappedOut -= mySwappedOut; otherSwappedOutPss -= mySwappedOutPss; otherRss -= myRss; } } dumpMemoryInfo(proto, MemInfoDumpProto.ProcessMemory.UNKNOWN_HEAP, "Unknown", otherPss, otherSwappablePss, otherSharedDirty, otherPrivateDirty, otherSharedClean, otherPrivateClean, memInfo.hasSwappedOutPss, otherSwappedOut, otherSwappedOutPss); memInfo.hasSwappedOutPss, otherSwappedOut, otherSwappedOutPss, otherRss); final long tToken = proto.start(MemInfoDumpProto.ProcessMemory.TOTAL_HEAP); dumpMemoryInfo(proto, MemInfoDumpProto.ProcessMemory.HeapInfo.MEM_INFO, "TOTAL", memInfo.getTotalPss(), memInfo.getTotalSwappablePss(), memInfo.getTotalSharedDirty(), memInfo.getTotalPrivateDirty(), memInfo.getTotalSharedClean(), memInfo.getTotalPrivateClean(), memInfo.hasSwappedOutPss, memInfo.getTotalSwappedOut(), memInfo.getTotalSwappedOutPss()); memInfo.getTotalSwappedOutPss(), memInfo.getTotalRss()); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_SIZE_KB, nativeMax + dalvikMax); proto.write(MemInfoDumpProto.ProcessMemory.HeapInfo.HEAP_ALLOC_KB, Loading @@ -2923,6 +2940,7 @@ public final class ActivityThread extends ClientTransactionHandler { final int myPrivateClean = memInfo.getOtherPrivateClean(i); final int mySwappedOut = memInfo.getOtherSwappedOut(i); final int mySwappedOutPss = memInfo.getOtherSwappedOutPss(i); final int myRss = memInfo.getOtherRss(i); if (myPss != 0 || mySharedDirty != 0 || myPrivateDirty != 0 || mySharedClean != 0 || myPrivateClean != 0 || (memInfo.hasSwappedOutPss ? mySwappedOutPss : mySwappedOut) != 0) { Loading @@ -2930,7 +2948,7 @@ public final class ActivityThread extends ClientTransactionHandler { Debug.MemoryInfo.getOtherLabel(i), myPss, mySwappablePss, mySharedDirty, myPrivateDirty, mySharedClean, myPrivateClean, memInfo.hasSwappedOutPss, mySwappedOut, mySwappedOutPss); memInfo.hasSwappedOutPss, mySwappedOut, mySwappedOutPss, myRss); } } } Loading Loading @@ -2958,6 +2976,19 @@ public final class ActivityThread extends ClientTransactionHandler { proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.TOTAL_SWAP_PSS, memInfo.getSummaryTotalSwap()); } proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.JAVA_HEAP_RSS_KB, memInfo.getSummaryJavaHeapRss()); proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.NATIVE_HEAP_RSS_KB, memInfo.getSummaryNativeHeapRss()); proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.CODE_RSS_KB, memInfo.getSummaryCodeRss()); proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.STACK_RSS_KB, memInfo.getSummaryStackRss()); proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.GRAPHICS_RSS_KB, memInfo.getSummaryGraphicsRss()); proto.write(MemInfoDumpProto.ProcessMemory.AppSummary.UNKNOWN_RSS_KB, memInfo.getSummaryUnknownRss()); proto.end(asToken); } Loading
core/java/android/os/Debug.java +62 −0 Original line number Diff line number Diff line Loading @@ -786,6 +786,68 @@ public final class Debug - getTotalPrivateDirty(); } /** * Rss of Java Heap bytes in KB due to the application. * @hide */ public int getSummaryJavaHeapRss() { return dalvikRss + getOtherRss(OTHER_ART); } /** * Rss of Native Heap bytes in KB due to the application. * @hide */ public int getSummaryNativeHeapRss() { return nativeRss; } /** * Rss of code and other static resource bytes in KB due to * the application. * @hide */ public int getSummaryCodeRss() { return getOtherRss(OTHER_SO) + getOtherRss(OTHER_JAR) + getOtherRss(OTHER_APK) + getOtherRss(OTHER_TTF) + getOtherRss(OTHER_DEX) + getOtherRss(OTHER_OAT); } /** * Rss in KB of the stack due to the application. * @hide */ public int getSummaryStackRss() { return getOtherRss(OTHER_STACK); } /** * Rss in KB of graphics due to the application. * @hide */ public int getSummaryGraphicsRss() { return getOtherRss(OTHER_GL_DEV) + getOtherRss(OTHER_GRAPHICS) + getOtherRss(OTHER_GL); } /** * Rss in KB due to either the application or system that haven't otherwise been * accounted for. * @hide */ public int getSummaryUnknownRss() { return getTotalRss() - getSummaryJavaHeapRss() - getSummaryNativeHeapRss() - getSummaryCodeRss() - getSummaryStackRss() - getSummaryGraphicsRss(); } /** * Total Pss in KB. * @hide Loading
core/proto/android/server/activitymanagerservice.proto +17 −1 Original line number Diff line number Diff line Loading @@ -261,6 +261,8 @@ message MemInfoDumpProto { // The dirty the pages that have been swapped out, proportional. int32 dirty_swap_pss_kb = 9; } // The rss set size for the heap. optional int32 total_rss_kb = 10; } message HeapInfo { option (.android.msg_privacy).dest = DEST_AUTOMATIC; Loading Loading @@ -294,6 +296,12 @@ message MemInfoDumpProto { int32 total_swap_pss = 8; int32 total_swap_kb = 9; } optional int32 java_heap_rss_kb = 10; optional int32 native_heap_rss_kb = 11; optional int32 code_rss_kb = 12; optional int32 stack_rss_kb = 13; optional int32 graphics_rss_kb = 14; optional int32 unknown_rss_kb = 15; } optional AppSummary app_summary = 9; } Loading Loading @@ -359,10 +367,16 @@ message MemInfoDumpProto { optional int32 id = 3; optional bool is_proc = 4; optional bool has_activities = 5; optional int64 pss_kb = 6; oneof ss_kb { int64 pss_kb = 6; int64 rss_kb = 9; } optional int64 swap_pss_kb = 7; repeated MemItem sub_items = 8; } repeated MemItem total_rss_by_process = 29; repeated MemItem total_rss_by_oom_adjustment = 30; repeated MemItem total_rss_by_category = 31; repeated MemItem total_pss_by_process = 5; repeated MemItem total_pss_by_oom_adjustment = 6; repeated MemItem total_pss_by_category = 7; Loading Loading @@ -414,6 +428,8 @@ message MemInfoDumpProto { optional bool is_low_ram_device = 27; optional bool is_high_end_gfx = 28; // Next Tag: 32 } message StickyBroadcastProto { Loading
services/core/java/com/android/server/am/ActivityManagerService.java +163 −54 File changed.Preview size limit exceeded, changes collapsed. Show changes