public class StopWatch extends Object
LatencyCounter features. A
StopWach is created with a name and immediately starts measuring time. When
calling stop(), the elapsed time is registered at a central latency counter
identified by the stopwatch's name.
StopWatch watch = new StopWatch("mytest");
Thread.sleep(delay);
watch.stop();
You can use a stop watch only a single time, so you have to create a new
instance for each measurement you are performing. After the desired number of
invocations, you can query the associated LatencyCounter from the
CounterRepository and query its features, e.g.
LatencyCounter counter = CounterRepository.getInstance("mytest");
System.out.println("avg:" + counter.averageLatency + ", max:" + counter.maxLatency())
CounterRepository,
LatencyCounterpublic StopWatch(String name)
Copyright © 2019. All rights reserved.