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();
}
}
【游戏服务器Util】 commons-lang3.jar StopWatch 计时
最新推荐文章于 2024-09-27 14:07:14 发布