diff options
author | Igor Murashkin <iam@google.com> | 2013-10-23 10:56:02 -0700 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2013-10-23 14:43:05 -0700 |
commit | 44d04aa0ace68e6164c5eb7b3536c0992aaf5a3a (patch) | |
tree | bb940ccb8e59928ce4d32bb5ff7810a03c8977f6 /services/java/com | |
parent | 2f566900a4fdeab75c972259a97dfb40b96df421 (diff) | |
download | frameworks_base-44d04aa0ace68e6164c5eb7b3536c0992aaf5a3a.zip frameworks_base-44d04aa0ace68e6164c5eb7b3536c0992aaf5a3a.tar.gz frameworks_base-44d04aa0ace68e6164c5eb7b3536c0992aaf5a3a.tar.bz2 |
am: Increase dropbox buffer size to 256KB (from 128KB)
Minor changes for dumping stack traces:
- Print the native traces right after foreground/persistent apps
- Also include mediaserver, sdcard, and surfaceflinger in traces
Bug: 11321322
Change-Id: Ic09b7da316a5f197dda0ac3bde06f75574cc2166
Diffstat (limited to 'services/java/com')
-rw-r--r-- | services/java/com/android/server/Watchdog.java | 3 | ||||
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 32 |
2 files changed, 21 insertions, 14 deletions
diff --git a/services/java/com/android/server/Watchdog.java b/services/java/com/android/server/Watchdog.java index 616090e..dfffd2e 100644 --- a/services/java/com/android/server/Watchdog.java +++ b/services/java/com/android/server/Watchdog.java @@ -60,7 +60,8 @@ public class Watchdog extends Thread { static final int TIME_TO_WAIT = DB ? 5*1000 : 30*1000; - static final String[] NATIVE_STACKS_OF_INTEREST = new String[] { + // Which native processes to dump into dropbox's stack traces + public static final String[] NATIVE_STACKS_OF_INTEREST = new String[] { "/system/bin/mediaserver", "/system/bin/sdcard", "/system/bin/surfaceflinger" diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 3ba9098..e7ddd80 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -21,6 +21,7 @@ import static com.android.internal.util.XmlUtils.readIntAttribute; import static com.android.internal.util.XmlUtils.readLongAttribute; import static com.android.internal.util.XmlUtils.writeIntAttribute; import static com.android.internal.util.XmlUtils.writeLongAttribute; +import static com.android.server.Watchdog.NATIVE_STACKS_OF_INTEREST; import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT; import static org.xmlpull.v1.XmlPullParser.START_TAG; @@ -322,6 +323,9 @@ public final class ActivityManagerService extends ActivityManagerNative static final String[] EMPTY_STRING_ARRAY = new String[0]; + // How many bytes to write into the dropbox log before truncating + static final int DROPBOX_MAX_SIZE = 256 * 1024; + /** Run all ActivityStacks through this */ ActivityStackSupervisor mStackSupervisor; @@ -3687,7 +3691,17 @@ public final class ActivityManagerService extends ActivityManagerNative } } - // Next measure CPU usage. + // Next collect the stacks of the native pids + if (nativeProcs != null) { + int[] pids = Process.getPidsForCommands(nativeProcs); + if (pids != null) { + for (int pid : pids) { + Debug.dumpNativeBacktraceToFile(pid, tracesPath); + } + } + } + + // Lastly, measure CPU usage. if (processCpuTracker != null) { processCpuTracker.init(); System.gc(); @@ -3719,19 +3733,9 @@ public final class ActivityManagerService extends ActivityManagerNative } } } - } finally { observer.stopWatching(); } - - if (nativeProcs != null) { - int[] pids = Process.getPidsForCommands(nativeProcs); - if (pids != null) { - for (int pid : pids) { - Debug.dumpNativeBacktraceToFile(pid, tracesPath); - } - } - } } final void logAppTooSlow(ProcessRecord app, long startTime, String msg) { @@ -3895,7 +3899,8 @@ public final class ActivityManagerService extends ActivityManagerNative final ProcessCpuTracker processCpuTracker = new ProcessCpuTracker(true); - File tracesFile = dumpStackTraces(true, firstPids, processCpuTracker, lastPids, null); + File tracesFile = dumpStackTraces(true, firstPids, processCpuTracker, lastPids, + NATIVE_STACKS_OF_INTEREST); String cpuInfo = null; if (MONITOR_CPU_USAGE) { @@ -9820,7 +9825,8 @@ public final class ActivityManagerService extends ActivityManagerNative } if (logFile != null) { try { - sb.append(FileUtils.readTextFile(logFile, 128 * 1024, "\n\n[[TRUNCATED]]")); + sb.append(FileUtils.readTextFile(logFile, DROPBOX_MAX_SIZE, + "\n\n[[TRUNCATED]]")); } catch (IOException e) { Slog.e(TAG, "Error reading " + logFile, e); } |