Last active
August 29, 2015 14:05
-
-
Save bohrqiu/b05e3da42afb9d4ec7a7 to your computer and use it in GitHub Desktop.
btrace script monitor create new thread
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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