StopWatch
- allowing for timing of a number of tasks, exposing total running time and running time for each named task.
Methods
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@Slf4j
public class ... {
StopWatch stopwatch = new StopWatch();
stopWatch.start();
// logic 1
stopWatch.stop();
log.info("stopwatch 1 : " + stopWatch.getTotalTimeSeconds());
stopWatch.start();
// logic 2
stopWatch.stop();
log.info("stopwatch 2 : " + stopWatch.getTotalTimeSeconds());
// Generate a string with a table describing all tasks performed.
log.info(stopWatch.prettyPrint());
}
Comments powered by Disqus.