summaryrefslogtreecommitdiff
path: root/core/java/android/os/Debug.java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-01-29 16:52:08 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-01-29 16:52:08 +0000
commit6fa646ab95de0967a79bb9a136e75623de2cc808 (patch)
tree0cb8f3417bf1ccdc6b1346be0dc9f069a2b53f9a /core/java/android/os/Debug.java
parent7c00d9a4bfb3c92421f59a9ad560702a356afe8f (diff)
parente17b445b6c813f6f9bc93a5e3811128a197ef50b (diff)
Merge "Reduce pss collection amount, improve logging."
Diffstat (limited to 'core/java/android/os/Debug.java')
-rw-r--r--core/java/android/os/Debug.java60
1 files changed, 42 insertions, 18 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index f83bda06b0b2..e6069644caa5 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -116,6 +116,8 @@ public final class Debug
/** The proportional set size that is swappable for dalvik heap. */
/** @hide We may want to expose this, eventually. */
public int dalvikSwappablePss;
+ /** @hide The resident set size for dalvik heap. (Without other Dalvik overhead.) */
+ public int dalvikRss;
/** The private dirty pages used by dalvik heap. */
public int dalvikPrivateDirty;
/** The shared dirty pages used by dalvik heap. */
@@ -138,6 +140,8 @@ public final class Debug
/** The proportional set size that is swappable for the native heap. */
/** @hide We may want to expose this, eventually. */
public int nativeSwappablePss;
+ /** @hide The resident set size for the native heap. */
+ public int nativeRss;
/** The private dirty pages used by the native heap. */
public int nativePrivateDirty;
/** The shared dirty pages used by the native heap. */
@@ -160,6 +164,8 @@ public final class Debug
/** The proportional set size that is swappable for everything else. */
/** @hide We may want to expose this, eventually. */
public int otherSwappablePss;
+ /** @hide The resident set size for everything else. */
+ public int otherRss;
/** The private dirty pages used by everything else. */
public int otherPrivateDirty;
/** The shared dirty pages used by everything else. */
@@ -288,24 +294,26 @@ public final class Debug
public static final int NUM_DVK_STATS = 14;
/** @hide */
- public static final int NUM_CATEGORIES = 8;
+ public static final int NUM_CATEGORIES = 9;
/** @hide */
- public static final int offsetPss = 0;
+ public static final int OFFSET_PSS = 0;
/** @hide */
- public static final int offsetSwappablePss = 1;
+ public static final int OFFSET_SWAPPABLE_PSS = 1;
/** @hide */
- public static final int offsetPrivateDirty = 2;
+ public static final int OFFSET_RSS = 2;
/** @hide */
- public static final int offsetSharedDirty = 3;
+ public static final int OFFSET_PRIVATE_DIRTY = 3;
/** @hide */
- public static final int offsetPrivateClean = 4;
+ public static final int OFFSET_SHARED_DIRTY = 4;
/** @hide */
- public static final int offsetSharedClean = 5;
+ public static final int OFFSET_PRIVATE_CLEAN = 5;
/** @hide */
- public static final int offsetSwappedOut = 6;
+ public static final int OFFSET_SHARED_CLEAN = 6;
/** @hide */
- public static final int offsetSwappedOutPss = 7;
+ public static final int OFFSET_SWAPPED_OUT = 7;
+ /** @hide */
+ public static final int OFFSET_SWAPPED_OUT_PSS = 8;
private int[] otherStats = new int[(NUM_OTHER_STATS+NUM_DVK_STATS)*NUM_CATEGORIES];
@@ -337,6 +345,13 @@ public final class Debug
}
/**
+ * @hide Return total RSS memory usage in kB.
+ */
+ public int getTotalRss() {
+ return dalvikRss + nativeRss + otherRss;
+ }
+
+ /**
* Return total private dirty memory usage in kB.
*/
public int getTotalPrivateDirty() {
@@ -382,29 +397,32 @@ public final class Debug
/** @hide */
public int getOtherPss(int which) {
- return otherStats[which*NUM_CATEGORIES + offsetPss];
+ return otherStats[which * NUM_CATEGORIES + OFFSET_PSS];
}
-
/** @hide */
public int getOtherSwappablePss(int which) {
- return otherStats[which*NUM_CATEGORIES + offsetSwappablePss];
+ return otherStats[which * NUM_CATEGORIES + OFFSET_SWAPPABLE_PSS];
}
+ /** @hide */
+ public int getOtherRss(int which) {
+ return otherStats[which * NUM_CATEGORIES + OFFSET_RSS];
+ }
/** @hide */
public int getOtherPrivateDirty(int which) {
- return otherStats[which*NUM_CATEGORIES + offsetPrivateDirty];
+ return otherStats[which * NUM_CATEGORIES + OFFSET_PRIVATE_DIRTY];
}
/** @hide */
public int getOtherSharedDirty(int which) {
- return otherStats[which*NUM_CATEGORIES + offsetSharedDirty];
+ return otherStats[which * NUM_CATEGORIES + OFFSET_SHARED_DIRTY];
}
/** @hide */
public int getOtherPrivateClean(int which) {
- return otherStats[which*NUM_CATEGORIES + offsetPrivateClean];
+ return otherStats[which * NUM_CATEGORIES + OFFSET_PRIVATE_CLEAN];
}
/** @hide */
@@ -414,17 +432,17 @@ public final class Debug
/** @hide */
public int getOtherSharedClean(int which) {
- return otherStats[which*NUM_CATEGORIES + offsetSharedClean];
+ return otherStats[which * NUM_CATEGORIES + OFFSET_SHARED_CLEAN];
}
/** @hide */
public int getOtherSwappedOut(int which) {
- return otherStats[which*NUM_CATEGORIES + offsetSwappedOut];
+ return otherStats[which * NUM_CATEGORIES + OFFSET_SWAPPED_OUT];
}
/** @hide */
public int getOtherSwappedOutPss(int which) {
- return otherStats[which*NUM_CATEGORIES + offsetSwappedOutPss];
+ return otherStats[which * NUM_CATEGORIES + OFFSET_SWAPPED_OUT_PSS];
}
/** @hide */
@@ -741,6 +759,7 @@ public final class Debug
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(dalvikPss);
dest.writeInt(dalvikSwappablePss);
+ dest.writeInt(dalvikRss);
dest.writeInt(dalvikPrivateDirty);
dest.writeInt(dalvikSharedDirty);
dest.writeInt(dalvikPrivateClean);
@@ -749,6 +768,7 @@ public final class Debug
dest.writeInt(dalvikSwappedOutPss);
dest.writeInt(nativePss);
dest.writeInt(nativeSwappablePss);
+ dest.writeInt(nativeRss);
dest.writeInt(nativePrivateDirty);
dest.writeInt(nativeSharedDirty);
dest.writeInt(nativePrivateClean);
@@ -757,6 +777,7 @@ public final class Debug
dest.writeInt(nativeSwappedOutPss);
dest.writeInt(otherPss);
dest.writeInt(otherSwappablePss);
+ dest.writeInt(otherRss);
dest.writeInt(otherPrivateDirty);
dest.writeInt(otherSharedDirty);
dest.writeInt(otherPrivateClean);
@@ -770,6 +791,7 @@ public final class Debug
public void readFromParcel(Parcel source) {
dalvikPss = source.readInt();
dalvikSwappablePss = source.readInt();
+ dalvikRss = source.readInt();
dalvikPrivateDirty = source.readInt();
dalvikSharedDirty = source.readInt();
dalvikPrivateClean = source.readInt();
@@ -778,6 +800,7 @@ public final class Debug
dalvikSwappedOutPss = source.readInt();
nativePss = source.readInt();
nativeSwappablePss = source.readInt();
+ nativeRss = source.readInt();
nativePrivateDirty = source.readInt();
nativeSharedDirty = source.readInt();
nativePrivateClean = source.readInt();
@@ -786,6 +809,7 @@ public final class Debug
nativeSwappedOutPss = source.readInt();
otherPss = source.readInt();
otherSwappablePss = source.readInt();
+ otherRss = source.readInt();
otherPrivateDirty = source.readInt();
otherSharedDirty = source.readInt();
otherPrivateClean = source.readInt();