java统计代码执行时间

put your code after "do something", then the standard output would show how long the code runs to end :

starTime=System.currentTimeMillis();

//do something

endTime=System.currentTimeMillis();

Time=endTime-starTime;

System.out.println(" execution time : " + Time);

思考:

如何更方便地做到对任意代码段实施运行时间的监控?如何不需要重复的复制上述代码?想想Greys,bitman,bittrace.

你可能感兴趣的:(java统计代码执行时间)