diff options
| author | Dianne Hackborn <hackbod@google.com> | 2011-07-17 13:31:17 -0700 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2011-07-17 13:48:37 -0700 |
| commit | 0e3328fbdd3845b0e2bec364e951498eaee6b079 (patch) | |
| tree | 044c12c2c12f55c1613704363e7c8256989a871e /core/java/android/app/ApplicationThreadNative.java | |
| parent | 9cbf8e270d4fd581c2e8bc7d9fc913de766bf242 (diff) | |
Rework and fix "adb shell dumpsys meminfo"
We now collect more detailed information splitting the maps into
additional useful categories.
Fixed some bugs in account, such as not correctly handling all of
the current dalvik allocations.
The activity manager now prints a final summary of all pss organized
by the apps and the categories.
Change-Id: Iafc5f27c998095812b1483c6803b8e0f0587aeae
Diffstat (limited to 'core/java/android/app/ApplicationThreadNative.java')
| -rw-r--r-- | core/java/android/app/ApplicationThreadNative.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java index 16181e0e8742..942f245bebf8 100644 --- a/core/java/android/app/ApplicationThreadNative.java +++ b/core/java/android/app/ApplicationThreadNative.java @@ -485,6 +485,48 @@ public abstract class ApplicationThreadNative extends Binder scheduleTrimMemory(level); return true; } + + case DUMP_MEM_INFO_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + ParcelFileDescriptor fd = data.readFileDescriptor(); + String[] args = data.readStringArray(); + Debug.MemoryInfo mi = null; + if (fd != null) { + try { + mi = dumpMemInfo(fd.getFileDescriptor(), args); + } finally { + try { + fd.close(); + } catch (IOException e) { + // swallowed, not propagated back to the caller + } + } + } + reply.writeNoException(); + mi.writeToParcel(reply, 0); + return true; + } + + case DUMP_GFX_INFO_TRANSACTION: + { + data.enforceInterface(IApplicationThread.descriptor); + ParcelFileDescriptor fd = data.readFileDescriptor(); + String[] args = data.readStringArray(); + if (fd != null) { + try { + dumpGfxInfo(fd.getFileDescriptor(), args); + } finally { + try { + fd.close(); + } catch (IOException e) { + // swallowed, not propagated back to the caller + } + } + } + reply.writeNoException(); + return true; + } } return super.onTransact(code, data, reply, flags); @@ -1004,4 +1046,28 @@ class ApplicationThreadProxy implements IApplicationThread { mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); } + + public Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, String[] args) throws RemoteException { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + data.writeFileDescriptor(fd); + data.writeStringArray(args); + mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0); + reply.readException(); + Debug.MemoryInfo info = new Debug.MemoryInfo(); + info.readFromParcel(reply); + data.recycle(); + reply.recycle(); + return info; + } + + public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException { + Parcel data = Parcel.obtain(); + data.writeInterfaceToken(IApplicationThread.descriptor); + data.writeFileDescriptor(fd); + data.writeStringArray(args); + mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); + data.recycle(); + } } |
