Skip to content

Instantly share code, notes, and snippets.

@bohrqiu
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bohrqiu/b05e3da42afb9d4ec7a7 to your computer and use it in GitHub Desktop.
Save bohrqiu/b05e3da42afb9d4ec7a7 to your computer and use it in GitHub Desktop.
btrace script monitor create new thread
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;
@BTrace
public class TracingScript {
public static int count = 0;
@OnMethod(clazz = "java.lang.Thread", method = "start")
public static void onNewThread() {
println(strcat("thread: " , str(currentThread())));
count++;
println(strcat("thead count:", str(count)));
jstack();
println();
println();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment