王筝的博客
ruby学习

 

import com.google.common.base.Stopwatch;
开始计时
Stopwatch stopwatch = Stopwatch.createStarted();

停止计时
stopwatch.stop();


计算出来的rt就是

stopwatch.elapsed(TimeUnit.MILLISECONDS)
日志输出样例
schedulingLogger.info("refresh[{}], gray:[{}], resultMap.size:[{}], elapsed(ms):[{}]",
dbEventMessage.getDbEnum().getTableName(), gray, positionTagAndTerminalMap.size(),
stopwatch.elapsed(TimeUnit.MILLISECONDS));

 

Leave a Reply