【游戏服务器Util】 commons-lang3.jar StopWatch 计时

来源:互联网 发布:农村淘宝是做什么的 编辑:程序博客网 时间:2024/04/28 16:08
public class StopWatchTest {//执行计时private final StopWatch watch;public StopWatchTest(){this.watch = new StopWatch();}public void test(){int n = 10000;while(n-->0){System.out.println(n);}}public void hello(){//执行业务watch.start();test();watch.stop();//记录执行时间long timeRunning = watch.getTime();System.err.println(timeRunning);}public static void main(String args[]){StopWatchTest t = new StopWatchTest();t.hello();}}

0 0
原创粉丝点击