Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.sun.btrace.annotations.BTrace;
- import com.sun.btrace.annotations.OnMethod;
- import com.sun.btrace.annotations.TLS;
- import com.sun.btrace.annotations.*;
- import static com.sun.btrace.BTraceUtils.*;
- @BTrace
- public class MyTest2Trace
- {
- @TLS
- private static long startTime = 0;
- @OnMethod(
- clazz="com.djk.demo2.MyTest2",
- method="test"
- )
- public static void startTime()
- {
- startTime = timeMillis();
- }
- @OnMethod(
- clazz="com.djk.demo2.MyTest2",
- method="test",
- location=@Location(Kind.RETURN)
- )
- public static void endTime()
- {
- println(strcat("the class method execute time=>", str(timeMillis()-startTime)));
- println("-------------------------------------------");
- }
- @OnMethod(clazz = "com.djk.demo2.MyTest2", method = "test", location = @Location(Kind.RETURN))
- public static void traceExecute(@ProbeClassName String name,@ProbeMethodName String method){
- println(strcat("the class name=>", name));
- println(strcat("the class method=>", method));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement