Stopwatch start = Stopwatch.createStarted().start(); // do something //可以使用不同的时间单位 start.elapsed(TimeUnit.HOURS);