org.databene.contiperf
Class StopWatch

java.lang.Object
  extended by org.databene.contiperf.StopWatch

public class StopWatch
extends Object

Stopwatch-style access to ContiPerf's 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())
 


Created: 14.01.2011 11:17:30

Since:
2.0.0
Author:
Volker Bergmann
See Also:
CounterRepository, LatencyCounter

Constructor Summary
StopWatch(String name)
           
 
Method Summary
 long stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StopWatch

public StopWatch(String name)
Method Detail

stop

public long stop()


Copyright © 2013. All Rights Reserved.