diff options
| author | Dianne Hackborn <hackbod@google.com> | 2011-08-05 17:50:29 -0700 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2011-08-05 18:18:05 -0700 |
| commit | b437e090ec03a2bab10bdfcb9484577a7f34e157 (patch) | |
| tree | 86424e259db63fb8c7780a433b2eb808950fbc49 /core/java/android/app/ActivityThread.java | |
| parent | 284585aa835096111c7129b330f458b75ed27a8d (diff) | |
| download | frameworks_base-b437e090ec03a2bab10bdfcb9484577a7f34e157.zip frameworks_base-b437e090ec03a2bab10bdfcb9484577a7f34e157.tar.gz frameworks_base-b437e090ec03a2bab10bdfcb9484577a7f34e157.tar.bz2 | |
Improved memory use reporting.
Change-Id: I38e53e6228bba92a142bafeedb5af8df4e4e5724
Diffstat (limited to 'core/java/android/app/ActivityThread.java')
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index c566104..d5f630a 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -729,17 +729,19 @@ public final class ActivityThread { } @Override - public Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, String[] args) { + public Debug.MemoryInfo dumpMemInfo(FileDescriptor fd, boolean checkin, + boolean all, String[] args) { FileOutputStream fout = new FileOutputStream(fd); PrintWriter pw = new PrintWriter(fout); try { - return dumpMemInfo(pw, args); + return dumpMemInfo(pw, checkin, all, args); } finally { pw.flush(); } } - private Debug.MemoryInfo dumpMemInfo(PrintWriter pw, String[] args) { + private Debug.MemoryInfo dumpMemInfo(PrintWriter pw, boolean checkin, boolean all, + String[] args) { long nativeMax = Debug.getNativeHeapSize() / 1024; long nativeAllocated = Debug.getNativeHeapAllocatedSize() / 1024; long nativeFree = Debug.getNativeHeapFreeSize() / 1024; @@ -747,6 +749,10 @@ public final class ActivityThread { Debug.MemoryInfo memInfo = new Debug.MemoryInfo(); Debug.getMemoryInfo(memInfo); + if (!all) { + return memInfo; + } + Runtime runtime = Runtime.getRuntime(); long dalvikMax = runtime.totalMemory() / 1024; @@ -765,16 +771,8 @@ public final class ActivityThread { long sqliteAllocated = SQLiteDebug.getHeapAllocatedSize() / 1024; SQLiteDebug.PagerStats stats = SQLiteDebug.getDatabaseInfo(); - // Check to see if we were called by checkin server. If so, print terse format. - boolean doCheckinFormat = false; - if (args != null) { - for (String arg : args) { - if ("-c".equals(arg)) doCheckinFormat = true; - } - } - // For checkin, we print one long comma-separated list of values - if (doCheckinFormat) { + if (checkin) { // NOTE: if you change anything significant below, also consider changing // ACTIVITY_THREAD_CHECKIN_VERSION. String processName = (mBoundApplication != null) @@ -841,13 +839,17 @@ public final class ActivityThread { pw.print(sqliteAllocated); pw.print(','); pw.print(stats.memoryUsed / 1024); pw.print(','); pw.print(stats.pageCacheOverflo / 1024); pw.print(','); - pw.print(stats.largestMemAlloc / 1024); pw.print(','); + pw.print(stats.largestMemAlloc / 1024); for (int i = 0; i < stats.dbStats.size(); i++) { DbStats dbStats = stats.dbStats.get(i); - printRow(pw, DB_INFO_FORMAT, dbStats.pageSize, dbStats.dbSize, - dbStats.lookaside, dbStats.cache, dbStats.dbName); - pw.print(','); + pw.print(','); pw.print(dbStats.dbName); + pw.print(','); pw.print(dbStats.pageSize); + pw.print(','); pw.print(dbStats.dbSize); + pw.print(','); pw.print(dbStats.lookaside); + pw.print(','); pw.print(dbStats.cache); + pw.print(','); pw.print(dbStats.cache); } + pw.println(); return memInfo; } |
