StopWatch优雅实现统计代码耗时
#org.springframework.util.StopWatch
StopWatch stopWatch = new StopWatch();
stopWatch.start("task1");
//逻辑代码1
...
stopWatch.stop();
log.debug("task1执行耗时:{}ms",stopWatch.getLastTaskTimeMillis());
stopWatch.start("task2");
//逻辑代码2
...
stopWatch.stop();
log.debug("task2执行耗时:{}ms",stopWatch.getLastTaskTimeMillis());
log.debug("总执行耗时:{}ms",stopWatch.getTotalTimeMillis());
标签:SpringBoot,耗时,代码,---,stopWatch,ms,StopWatch,log
From: https://www.cnblogs.com/hujunwei/p/17565915.html