summaryrefslogtreecommitdiffstats
path: root/core/java/android/os
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-08-31 21:31:47 -0700
committerDianne Hackborn <hackbod@google.com>2009-09-01 11:16:25 -0700
commit3025ef332c29e255388f74b2afefe05f64bce07c (patch)
treeb7982d9ebe8a578b5b439c564c014a9af8be952f /core/java/android/os
parentd9942b5cb1662638bb6fb57c12a06976e3c34651 (diff)
downloadframeworks_base-3025ef332c29e255388f74b2afefe05f64bce07c.zip
frameworks_base-3025ef332c29e255388f74b2afefe05f64bce07c.tar.gz
frameworks_base-3025ef332c29e255388f74b2afefe05f64bce07c.tar.bz2
Various infrastructure to support a running services UI.
Some of this is temporary (in particular the two approaches for getting process memory, one working but horrible, the other not working but preferred) until I figure out the best way to do it. Change-Id: I8c8f25062d481fcea22a47d459b083d2fd8a5040
Diffstat (limited to 'core/java/android/os')
-rw-r--r--core/java/android/os/Debug.java53
1 files changed, 52 insertions, 1 deletions
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index b0fc78e..5352cf6 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -104,7 +104,7 @@ public final class Debug
* This class is used to retrieved various statistics about the memory mappings for this
* process. The returns info broken down by dalvik, native, and other. All results are in kB.
*/
- public static class MemoryInfo {
+ public static class MemoryInfo implements Parcelable {
/** The proportional set size for dalvik. */
public int dalvikPss;
/** The private dirty pages used by dalvik. */
@@ -125,6 +125,50 @@ public final class Debug
public int otherPrivateDirty;
/** The shared dirty pages used by everything else. */
public int otherSharedDirty;
+
+ public MemoryInfo() {
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(dalvikPss);
+ dest.writeInt(dalvikPrivateDirty);
+ dest.writeInt(dalvikSharedDirty);
+ dest.writeInt(nativePss);
+ dest.writeInt(nativePrivateDirty);
+ dest.writeInt(nativeSharedDirty);
+ dest.writeInt(otherPss);
+ dest.writeInt(otherPrivateDirty);
+ dest.writeInt(otherSharedDirty);
+ }
+
+ public void readFromParcel(Parcel source) {
+ dalvikPss = source.readInt();
+ dalvikPrivateDirty = source.readInt();
+ dalvikSharedDirty = source.readInt();
+ nativePss = source.readInt();
+ nativePrivateDirty = source.readInt();
+ nativeSharedDirty = source.readInt();
+ otherPss = source.readInt();
+ otherPrivateDirty = source.readInt();
+ otherSharedDirty = source.readInt();
+ }
+
+ public static final Creator<MemoryInfo> CREATOR = new Creator<MemoryInfo>() {
+ public MemoryInfo createFromParcel(Parcel source) {
+ return new MemoryInfo(source);
+ }
+ public MemoryInfo[] newArray(int size) {
+ return new MemoryInfo[size];
+ }
+ };
+
+ private MemoryInfo(Parcel source) {
+ readFromParcel(source);
+ }
}
@@ -556,6 +600,13 @@ href="{@docRoot}guide/developing/tools/traceview.html">Traceview: A Graphical Lo
public static native void getMemoryInfo(MemoryInfo memoryInfo);
/**
+ * Note: currently only works when the requested pid has the same UID
+ * as the caller.
+ * @hide
+ */
+ public static native void getMemoryInfo(int pid, MemoryInfo memoryInfo);
+
+ /**
* Establish an object allocation limit in the current thread. Useful
* for catching regressions in code that is expected to operate
* without causing any allocations.