Skip to content

Instantly share code, notes, and snippets.

@rednaxelafx
Created March 8, 2012 13:15
Show Gist options
  • Save rednaxelafx/2000950 to your computer and use it in GitHub Desktop.
Save rednaxelafx/2000950 to your computer and use it in GitHub Desktop.
BTrace script to log System.gc() calls
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;
@BTrace
public class TraceSystemGCCall {
@OnMethod(
clazz="/.*/",
method="/.*/",
location=@Location(
value=Kind.CALL,
clazz="java.lang.System",
method="gc"
)
)
public static void onSystemGC() {
jstack();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment