java如何计算响应时长rt

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));

你可能感兴趣的:(java)