guava Stopwatch
guava提供了Stopwatch用于计算程序执行中的时间消耗。那么为什么需要这个类了?我们首先看看通常我们是如何计算时间消耗的。
long start = System.nanoTime();
Uninterruptibles.sleepUninterruptibly(2, TimeUnit.SECONDS);
System.out.println("耗时:" + (System.nanoTime() - start));
如果使用Stopwatch应该如
原创
2021-05-13 12:50:40 ·
489 阅读 ·
0 评论