Advertisement
Guest User

Untitled

a guest
May 27th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import com.sun.btrace.annotations.BTrace;
  2. import com.sun.btrace.annotations.OnMethod;
  3. import com.sun.btrace.annotations.TLS;
  4. import com.sun.btrace.annotations.*;
  5. import static com.sun.btrace.BTraceUtils.*;
  6.  
  7. @BTrace
  8. public class MyTest2Trace
  9. {
  10. @TLS
  11. private static long startTime = 0;
  12.  
  13. @OnMethod(
  14. clazz="com.djk.demo2.MyTest2",
  15. method="test"
  16. )
  17.  
  18. public static void startTime()
  19. {
  20. startTime = timeMillis();
  21. }
  22.  
  23.  
  24. @OnMethod(
  25. clazz="com.djk.demo2.MyTest2",
  26. method="test",
  27. location=@Location(Kind.RETURN)
  28. )
  29.  
  30. public static void endTime()
  31. {
  32. println(strcat("the class method execute time=>", str(timeMillis()-startTime)));
  33. println("-------------------------------------------");
  34. }
  35.  
  36. @OnMethod(clazz = "com.djk.demo2.MyTest2", method = "test", location = @Location(Kind.RETURN))
  37. public static void traceExecute(@ProbeClassName String name,@ProbeMethodName String method){
  38. println(strcat("the class name=>", name));
  39. println(strcat("the class method=>", method));
  40.  
  41. }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement