diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-09-17 10:24:05 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-09-17 11:13:45 -0700 |
commit | 4f21c4cf077cfee5b35a56703618115614bc40f2 (patch) | |
tree | 4f3ef99f737c731521ab5f8e81fba2e18e8facba /services | |
parent | 7805933738de33b1961bd03553237a86d90792dd (diff) | |
download | frameworks_base-4f21c4cf077cfee5b35a56703618115614bc40f2.zip frameworks_base-4f21c4cf077cfee5b35a56703618115614bc40f2.tar.gz frameworks_base-4f21c4cf077cfee5b35a56703618115614bc40f2.tar.bz2 |
Add API to retrieve memory used by running processes.
Change-Id: I9c1935c2ef3c78bd67ec4dfd811a1caaab4514c3
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 66ef557..1597270 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -4921,23 +4921,14 @@ public final class ActivityManagerService extends ActivityManagerNative implemen Binder.restoreCallingIdentity(origId); } - public void getProcessMemoryInfo(int pid, Debug.MemoryInfo mi) + public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids) throws RemoteException { - ProcessRecord proc; - synchronized (mPidsSelfLocked) { - proc = mPidsSelfLocked.get(pid); + Debug.MemoryInfo[] infos = new Debug.MemoryInfo[pids.length]; + for (int i=pids.length-1; i>=0; i--) { + infos[i] = new Debug.MemoryInfo(); + Debug.getMemoryInfo(pids[i], infos[i]); } - - if (proc == null) { - throw new RemoteException(); - } - - IApplicationThread thread = proc.thread; - if (thread == null) { - throw new RemoteException(); - } - - thread.getMemoryInfo(mi); + return infos; } public void killApplicationProcess(String processName, int uid) { |