btrace 性能跟踪

先悼念一下可怜的javaeye,和我140余篇文章。 天朝威武

 

http://kenai.com/projects/btrace/pages/UserGuide 官方站点

 

但是这里没有演示如何追踪一个函数的执行时间, 还是从一个链接上翻到另外一篇才得解:

http://www.carlobonamico.com/blog/tag/btrace/

使用到@Location(Kind.RETURN)一说

 

@BTrace public class WebServiceTracker { // store webservice entry time in this thread local @TLS private static long startTime; @OnMethod( clazz="@javax.jws.WebService", method="@javax.jws.WebMethod" ) public static void onWebserviceEntry() { print("entering webservice "); println(strcat(strcat(name(probeClass()), "."), probeMethod())); startTime = timeMillis(); } @OnMethod( clazz="@javax.jws.WebService", method="@javax.jws.WebMethod", location=@Location(Kind.RETURN) ) public static void onWebserviceReturn() { println(strcat("Time taken (msec) ", str(timeMillis() - startTime))); println("=========================="); } } 

你可能感兴趣的:(thread,webservice,Class)