summaryrefslogtreecommitdiff
path: root/services/java
diff options
context:
space:
mode:
author Christopher Tate <ctate@google.com> 2010-06-04 18:06:07 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-06-04 18:06:07 -0700
commitdf2e2eff9446c0220515fa7aab7857135e04e12e (patch)
treedd1c383a329395a203d88da23618778ddce30c6c /services/java
parent5474902fe9fe72c825855c4a77f99a581a9f6594 (diff)
parentecaa7b41ca49154ceaa9a7504eb0a86b89a96026 (diff)
Merge "Watchdog now records kernel stacks when it fires" into froyo
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/Watchdog.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/services/java/com/android/server/Watchdog.java b/services/java/com/android/server/Watchdog.java
index 5eaadbc39343..d4133f309338 100644
--- a/services/java/com/android/server/Watchdog.java
+++ b/services/java/com/android/server/Watchdog.java
@@ -39,6 +39,8 @@ import android.util.Log;
import android.util.Slog;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
@@ -51,6 +53,9 @@ public class Watchdog extends Thread {
// Set this to true to use debug default values.
static final boolean DB = false;
+ // Set this to true to have the watchdog record kernel thread stacks when it fires
+ static final boolean RECORD_KERNEL_THREADS = true;
+
static final int MONITOR = 2718;
static final int GLOBAL_PSS = 2719;
@@ -850,6 +855,11 @@ public class Watchdog extends Thread {
// The system's been hanging for a minute, another second or two won't hurt much.
SystemClock.sleep(2000);
+ // Pull our own kernel thread stacks as well if we're configured for that
+ if (RECORD_KERNEL_THREADS) {
+ dumpKernelStackTraces();
+ }
+
mActivity.addErrorToDropBox("watchdog", null, null, null, name, null, stack, null);
// Only kill the process if the debugger is not attached.
@@ -864,4 +874,16 @@ public class Watchdog extends Thread {
waitedHalf = false;
}
}
+
+ private File dumpKernelStackTraces() {
+ String tracesPath = SystemProperties.get("dalvik.vm.stack-trace-file", null);
+ if (tracesPath == null || tracesPath.length() == 0) {
+ return null;
+ }
+
+ native_dumpKernelStacks(tracesPath);
+ return new File(tracesPath);
+ }
+
+ private native void native_dumpKernelStacks(String tracesPath);
}