User Guide: https://kenai.com/projects/btrace/pages/UserGuide
Download binaries here:
https://kenai.com/projects/btrace/downloads/download/releases/current/btrace-bin.tar.gz
Java class under test:
BTraceTest.java:
Btrace profiling class: Btrace1.java:
compile it:
./btracec -classpath . ./Btrace1.java
run it:
./btrace -classpath . 24160 ./Btrace1.class
where 24160 is the PID of the BTraceTest java application
It works! It's great!
Download binaries here:
https://kenai.com/projects/btrace/downloads/download/releases/current/btrace-bin.tar.gz
Java class under test:
BTraceTest.java:
public class BTraceTest {
public static void main(String[] args) throws Exception {
for (int i = 0; i < 1000000; i++) {
Thread.sleep(1000);
doSomething();
}
}
public static void doSomething() {
System.out.println("something");
}
}
Btrace profiling class: Btrace1.java:
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;
import java.lang.reflect.Field;
@BTrace public class Btrace1 {
@OnMethod(
clazz="BTraceTest",
method="doSomething"
)
public static void onDoSomething() {
println("got it");
}
}
compile it:
./btracec -classpath . ./Btrace1.java
run it:
./btrace -classpath . 24160 ./Btrace1.class
where 24160 is the PID of the BTraceTest java application
It works! It's great!