Stopwatch - YUHAO-ZX/StudyCollection GitHub Wiki

google Stopwatch:计时器功能

1.com.google.common.base.Stopwatch用法

//创建并开始计时
Stopwatch stopwatch = Stopwatch.createStarted();
//停止计时
stopwatch.stop();
//获取当前计时记录,可获取多种类型结果,秒,毫秒,微秒,纳秒等
stopwatch.elapsed(TimeUnit.MILLISECONDS)
//重设时间
stopwatch.reset()
//判断时候在运行
stopwatch.isRunning()