1.
Stopwatch stopwatch = Stopwatch.createStarted();
// 业务代码
stopwatch.stop();
log.info("运行时间:" + stopwatch.elapsed(TimeUnit.MILLISECONDS) + "毫秒");
2.
Long startTime = System.currentTimeMillis();
// 业务代码
log.info("耗时:{}",System.currentTimeMillis() - startTime);
网友评论