1 package org.kuali.common.jute.base;
2
3 import static com.google.common.base.Stopwatch.createStarted;
4 import static java.util.concurrent.TimeUnit.MILLISECONDS;
5
6 import java.util.concurrent.TimeUnit;
7
8 import com.google.common.base.Stopwatch;
9
10
11
12
13 public final class RunningStopwatch {
14
15 public RunningStopwatch() {
16 this.stopwatch = createStarted();
17 }
18
19 private final Stopwatch stopwatch;
20
21 public long elapsedMillis() {
22 return elapsed(MILLISECONDS);
23 }
24
25 public long elapsed(TimeUnit unit) {
26 synchronized (stopwatch) {
27 return stopwatch.elapsed(unit);
28 }
29 }
30
31 }