性能监控工具类(StopWatchUtil)


关键字:性能监控工具类(StopWatchUtil)



附件是工具类,请下载使用。



使用方法如下:


public static void main(String[] args) throws InterruptedException {
StopWatchUtil stopWatch = new StopWatchUtil("测试过滤词导出功能性能消耗情况");

stopWatch.start("任务1");
Thread.sleep(2000); // simulated work
stopWatch.stop();

stopWatch.start("任务2");
Thread.sleep(5000); // simulated work
stopWatch.stop();

stopWatch.start("任务3");
Thread.sleep(3000); // simulated work
stopWatch.stop();

stopWatch.start("任务4");
Thread.sleep(1000); // simulated work
stopWatch.stop();

System.out.println(stopWatch.prettyPrint());

System.out.println(stopWatch.toString());
}


你可能感兴趣的:(util)