summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/ActivityThread.java76
-rw-r--r--core/java/android/os/Debug.java97
2 files changed, 148 insertions, 25 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 82ecfa3..d1bf0af 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -543,13 +543,13 @@ public final class ActivityThread {
private native void dumpGraphicsInfo(FileDescriptor fd);
private class ApplicationThread extends ApplicationThreadNative {
- private static final String HEAP_COLUMN = "%13s %8s %8s %8s %8s %8s %8s %8s";
+ private static final String HEAP_COLUMN = "%13s %8s %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 DB_INFO_FORMAT = " %8s %8s %14s %14s %s";
// Formatting for checkin service - update version if row format changes
- private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 1;
+ private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 2;
private void updatePendingConfiguration(Configuration config) {
synchronized (mPackages) {
@@ -970,6 +970,12 @@ public final class ActivityThread {
pw.print(memInfo.otherPss); pw.print(',');
pw.print(memInfo.nativePss + memInfo.dalvikPss + memInfo.otherPss); pw.print(',');
+ // Heap info - proportional set size
+ pw.print(memInfo.nativeSwappablePss); pw.print(',');
+ pw.print(memInfo.dalvikSwappablePss); pw.print(',');
+ pw.print(memInfo.otherSwappablePss); pw.print(',');
+ pw.print(memInfo.nativeSwappablePss + memInfo.dalvikSwappablePss + memInfo.otherSwappablePss); pw.print(',');
+
// Heap info - shared dirty
pw.print(memInfo.nativeSharedDirty); pw.print(',');
pw.print(memInfo.dalvikSharedDirty); pw.print(',');
@@ -984,7 +990,7 @@ public final class ActivityThread {
pw.print(memInfo.nativeSharedClean + memInfo.dalvikSharedClean
+ memInfo.otherSharedClean); pw.print(',');
- // Heap info - private
+ // Heap info - private Dirty
pw.print(memInfo.nativePrivateDirty); pw.print(',');
pw.print(memInfo.dalvikPrivateDirty); pw.print(',');
pw.print(memInfo.otherPrivateDirty); pw.print(',');
@@ -992,6 +998,14 @@ public final class ActivityThread {
+ memInfo.otherPrivateDirty); pw.print(',');
+ // Heap info - private Clean
+ pw.print(memInfo.nativePrivateClean); pw.print(',');
+ pw.print(memInfo.dalvikPrivateClean); pw.print(',');
+ pw.print(memInfo.otherPrivateClean); pw.print(',');
+ pw.print(memInfo.nativePrivateClean + memInfo.dalvikPrivateClean
+ + memInfo.otherPrivateClean); pw.print(',');
+
+
// Object counts
pw.print(viewInstanceCount); pw.print(',');
pw.print(viewRootInstanceCount); pw.print(',');
@@ -1026,36 +1040,62 @@ public final class ActivityThread {
}
// otherwise, show human-readable format
- printRow(pw, HEAP_COLUMN, "", "", "Shared", "Private", "Shared", "Heap", "Heap", "Heap");
- printRow(pw, HEAP_COLUMN, "", "Pss", "Dirty", "Dirty", "Clean", "Size", "Alloc", "Free");
- printRow(pw, HEAP_COLUMN, "", "------", "------", "------", "------", "------", "------",
+ printRow(pw, HEAP_COLUMN, "", "", "Swapable","Shared", "Private", "Shared", "Private", "Heap", "Heap", "Heap");
+ printRow(pw, HEAP_COLUMN, "", "Pss", "Pss", "Dirty", "Dirty", "Clean", "Clean", "Size", "Alloc", "Free");
+ printRow(pw, HEAP_COLUMN, "", "------", "------", "------", "------", "------", "------", "------", "------",
"------");
- printRow(pw, HEAP_COLUMN, "Native", memInfo.nativePss, memInfo.nativeSharedDirty,
- memInfo.nativePrivateDirty, memInfo.nativeSharedClean, nativeMax, nativeAllocated, nativeFree);
- printRow(pw, HEAP_COLUMN, "Dalvik", memInfo.dalvikPss, memInfo.dalvikSharedDirty,
- memInfo.dalvikPrivateDirty, memInfo.dalvikSharedClean, dalvikMax, dalvikAllocated, dalvikFree);
+ printRow(pw, HEAP_COLUMN, "Native", memInfo.nativePss, memInfo.nativeSwappablePss, memInfo.nativeSharedDirty,
+ memInfo.nativePrivateDirty, memInfo.nativeSharedClean, memInfo.nativePrivateClean,nativeMax,
+ nativeAllocated, nativeFree);
+ printRow(pw, HEAP_COLUMN, "Dalvik", memInfo.dalvikPss, memInfo.dalvikSwappablePss, memInfo.dalvikSharedDirty,
+ memInfo.dalvikPrivateDirty, memInfo.dalvikSharedClean, memInfo.dalvikPrivateClean, dalvikMax, dalvikAllocated,
+ dalvikFree);
int otherPss = memInfo.otherPss;
+ int otherSwappablePss = memInfo.otherSwappablePss;
int otherSharedDirty = memInfo.otherSharedDirty;
int otherPrivateDirty = memInfo.otherPrivateDirty;
int otherSharedClean = memInfo.otherSharedClean;
+ int otherPrivateClean = memInfo.otherPrivateClean;
for (int i=0; i<Debug.MemoryInfo.NUM_OTHER_STATS; i++) {
printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
- memInfo.getOtherPss(i), memInfo.getOtherSharedDirty(i),
- memInfo.getOtherPrivateDirty(i), memInfo.getOtherSharedClean(i), "", "", "");
+ memInfo.getOtherPss(i), memInfo.getOtherSwappablePss(i), memInfo.getOtherSharedDirty(i),
+ memInfo.getOtherPrivateDirty(i), memInfo.getOtherSharedClean(i), memInfo.getOtherPrivateClean(i),
+ "", "", "");
otherPss -= memInfo.getOtherPss(i);
+ otherSwappablePss -= memInfo.getOtherSwappablePss(i);
otherSharedDirty -= memInfo.getOtherSharedDirty(i);
otherPrivateDirty -= memInfo.getOtherPrivateDirty(i);
otherSharedClean -= memInfo.getOtherSharedClean(i);
+ otherPrivateClean -= memInfo.getOtherPrivateClean(i);
}
- printRow(pw, HEAP_COLUMN, "Unknown", otherPss, otherSharedDirty,
- otherPrivateDirty, otherSharedClean, "", "", "");
- printRow(pw, HEAP_COLUMN, "TOTAL", memInfo.getTotalPss(),
- memInfo.getTotalSharedDirty(), memInfo.getTotalPrivateDirty(),
- memInfo.getTotalSharedClean(), nativeMax+dalvikMax,
- nativeAllocated+dalvikAllocated, nativeFree+dalvikFree);
+
+
+ printRow(pw, HEAP_COLUMN, "Unknown", otherPss, otherSwappablePss, otherSharedDirty,
+ otherPrivateDirty, otherSharedClean, otherPrivateClean,"", "", "");
+ printRow(pw, HEAP_COLUMN, "TOTAL", memInfo.getTotalPss(), memInfo.getTotalSwappablePss(),
+ memInfo.getTotalSharedDirty(), memInfo.getTotalPrivateDirty(),
+ memInfo.getTotalSharedClean(), memInfo.getTotalPrivateClean(), nativeMax+dalvikMax,
+ nativeAllocated+dalvikAllocated, nativeFree+dalvikFree);
+
+ pw.println(" ");
+ pw.println(" Dalvik");
+
+ for (int i=Debug.MemoryInfo.NUM_OTHER_STATS;
+ i<Debug.MemoryInfo.NUM_OTHER_STATS + Debug.MemoryInfo.NUM_DVK_STATS; i++) {
+ printRow(pw, HEAP_COLUMN, Debug.MemoryInfo.getOtherLabel(i),
+ memInfo.getOtherPss(i), memInfo.getOtherSwappablePss(i), memInfo.getOtherSharedDirty(i),
+ memInfo.getOtherPrivateDirty(i), memInfo.getOtherSharedClean(i),
+ memInfo.getOtherPrivateClean(i), "", "", "");
+ otherPss -= memInfo.getOtherPss(i);
+ otherSwappablePss -= memInfo.getOtherSwappablePss(i);
+ otherSharedDirty -= memInfo.getOtherSharedDirty(i);
+ otherPrivateDirty -= memInfo.getOtherPrivateDirty(i);
+ otherSharedClean -= memInfo.getOtherSharedClean(i);
+ otherPrivateClean -= memInfo.getOtherPrivateClean(i);
+ }
pw.println(" ");
pw.println(" Objects");
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 72ef606..d8e30e2 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -110,38 +110,76 @@ public final class Debug
public static class MemoryInfo implements Parcelable {
/** The proportional set size for dalvik. */
public int dalvikPss;
+ /** The proportional set size that is swappable for dalvik. */
+ /** @hide We may want to expose this, eventually. */
+ public int dalvikSwappablePss;
/** The private dirty pages used by dalvik. */
public int dalvikPrivateDirty;
/** The shared dirty pages used by dalvik. */
public int dalvikSharedDirty;
+ /** The private clean pages used by dalvik. */
+ /** @hide We may want to expose this, eventually. */
+ public int dalvikPrivateClean;
/** The shared clean pages used by dalvik. */
+ /** @hide We may want to expose this, eventually. */
public int dalvikSharedClean;
/** The proportional set size for the native heap. */
public int nativePss;
+ /** The proportional set size that is swappable for the native heap. */
+ /** @hide We may want to expose this, eventually. */
+ public int nativeSwappablePss;
/** The private dirty pages used by the native heap. */
public int nativePrivateDirty;
/** The shared dirty pages used by the native heap. */
public int nativeSharedDirty;
+ /** The private clean pages used by the native heap. */
+ /** @hide We may want to expose this, eventually. */
+ public int nativePrivateClean;
/** The shared clean pages used by the native heap. */
+ /** @hide We may want to expose this, eventually. */
public int nativeSharedClean;
/** The proportional set size for everything else. */
public int otherPss;
+ /** The proportional set size that is swappable for everything else. */
+ /** @hide We may want to expose this, eventually. */
+ public int otherSwappablePss;
/** The private dirty pages used by everything else. */
public int otherPrivateDirty;
/** The shared dirty pages used by everything else. */
public int otherSharedDirty;
+ /** The private clean pages used by everything else. */
+ /** @hide We may want to expose this, eventually. */
+ public int otherPrivateClean;
/** The shared clean pages used by everything else. */
+ /** @hide We may want to expose this, eventually. */
public int otherSharedClean;
/** @hide */
public static final int NUM_OTHER_STATS = 12;
/** @hide */
- public static final int NUM_CATEGORIES = 4;
+ public static final int NUM_DVK_STATS = 5;
- private int[] otherStats = new int[NUM_OTHER_STATS*NUM_CATEGORIES];
+ /** @hide */
+ public static final int NUM_CATEGORIES = 6;
+
+ /** @hide */
+ public static final int offsetPss = 0;
+ /** @hide */
+ public static final int offsetSwappablePss = 1;
+ /** @hide */
+ public static final int offsetPrivateDirty = 2;
+ /** @hide */
+ public static final int offsetSharedDirty = 3;
+ /** @hide */
+ public static final int offsetPrivateClean = 4;
+ /** @hide */
+ public static final int offsetSharedClean = 5;
+
+
+ private int[] otherStats = new int[(NUM_OTHER_STATS+NUM_DVK_STATS)*NUM_CATEGORIES];
public MemoryInfo() {
}
@@ -153,6 +191,14 @@ public final class Debug
return dalvikPss + nativePss + otherPss;
}
+
+ /**
+ * Return total PSS memory usage in kB.
+ */
+ public int getTotalSwappablePss() {
+ return dalvikSwappablePss + nativeSwappablePss + otherSwappablePss;
+ }
+
/**
* Return total private dirty memory usage in kB.
*/
@@ -170,30 +216,50 @@ public final class Debug
/**
* Return total shared clean memory usage in kB.
*/
+ public int getTotalPrivateClean() {
+ return dalvikPrivateClean + nativePrivateClean + otherPrivateClean;
+ }
+
+ /**
+ * Return total shared clean memory usage in kB.
+ */
public int getTotalSharedClean() {
return dalvikSharedClean + nativeSharedClean + otherSharedClean;
}
/* @hide */
public int getOtherPss(int which) {
- return otherStats[which*NUM_CATEGORIES];
+ return otherStats[which*NUM_CATEGORIES + offsetPss];
}
+
+ /* @hide */
+ public int getOtherSwappablePss(int which) {
+ return otherStats[which*NUM_CATEGORIES + offsetSwappablePss];
+ }
+
+
/* @hide */
public int getOtherPrivateDirty(int which) {
- return otherStats[which*NUM_CATEGORIES + 1];
+ return otherStats[which*NUM_CATEGORIES + offsetPrivateDirty];
}
/* @hide */
public int getOtherSharedDirty(int which) {
- return otherStats[which*NUM_CATEGORIES + 2];
+ return otherStats[which*NUM_CATEGORIES + offsetSharedDirty];
}
/* @hide */
+ public int getOtherPrivateClean(int which) {
+ return otherStats[which*NUM_CATEGORIES + offsetPrivateClean];
+ }
+
+
+ /* @hide */
public int getOtherSharedClean(int which) {
- return otherStats[which*NUM_CATEGORIES + 3];
+ return otherStats[which*NUM_CATEGORIES + offsetSharedClean];
}
-
+
/* @hide */
public static String getOtherLabel(int which) {
switch (which) {
@@ -209,6 +275,11 @@ public final class Debug
case 9: return "code mmap";
case 10: return "image mmap";
case 11: return "Other mmap";
+ case 12: return ".Heap";
+ case 13: return ".LOS";
+ case 14: return ".LinearAlloc";
+ case 15: return ".GC";
+ case 16: return ".JITCache";
default: return "????";
}
}
@@ -219,32 +290,44 @@ public final class Debug
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(dalvikPss);
+ dest.writeInt(dalvikSwappablePss);
dest.writeInt(dalvikPrivateDirty);
dest.writeInt(dalvikSharedDirty);
+ dest.writeInt(dalvikPrivateClean);
dest.writeInt(dalvikSharedClean);
dest.writeInt(nativePss);
+ dest.writeInt(nativeSwappablePss);
dest.writeInt(nativePrivateDirty);
dest.writeInt(nativeSharedDirty);
+ dest.writeInt(nativePrivateClean);
dest.writeInt(nativeSharedClean);
dest.writeInt(otherPss);
+ dest.writeInt(otherSwappablePss);
dest.writeInt(otherPrivateDirty);
dest.writeInt(otherSharedDirty);
+ dest.writeInt(otherPrivateClean);
dest.writeInt(otherSharedClean);
dest.writeIntArray(otherStats);
}
public void readFromParcel(Parcel source) {
dalvikPss = source.readInt();
+ dalvikSwappablePss = source.readInt();
dalvikPrivateDirty = source.readInt();
dalvikSharedDirty = source.readInt();
+ dalvikPrivateClean = source.readInt();
dalvikSharedClean = source.readInt();
nativePss = source.readInt();
+ nativeSwappablePss = source.readInt();
nativePrivateDirty = source.readInt();
nativeSharedDirty = source.readInt();
+ nativePrivateClean = source.readInt();
nativeSharedClean = source.readInt();
otherPss = source.readInt();
+ otherSwappablePss = source.readInt();
otherPrivateDirty = source.readInt();
otherSharedDirty = source.readInt();
+ otherPrivateClean = source.readInt();
otherSharedClean = source.readInt();
otherStats = source.createIntArray();
}