|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.elasticsearch.common.util.concurrent.ThreadBarrier.BarrierTimer
public static class ThreadBarrier.BarrierTimer
A Barrier action to be used in conjunction with ThreadBarrier
to
measure performance between barrier awaits. This runnable will execute
when the barrier is tripped. Make sure to reset() the timer before next
Measurement.
Usage example:
BarrierTimer timer = new BarrierTimer();
ThreadBarrier barrier = new ThreadBarrier( nTHREADS + 1, timer );
..
barrier.await(); // starts timer when all threads trip on await
barrier.await(); // stops timer when all threads trip on await
..
long time = timer.getTimeInNanos();
long tpi = time / ((long)nREPEATS * nTHREADS); //throughput per thread iteration
long secs = timer.getTimeInSeconds(); //total runtime in seconds
..
timer.reset(); // reuse timer
Constructor Summary | |
---|---|
ThreadBarrier.BarrierTimer()
|
Method Summary | |
---|---|
long |
getTimeInNanos()
Returns the elapsed time between two successive barrier executions. |
double |
getTimeInSeconds()
Returns the elapsed time between two successive barrier executions. |
void |
reset()
resets (clears) this timer before next execution. |
void |
run()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThreadBarrier.BarrierTimer()
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
public void reset()
public long getTimeInNanos()
public double getTimeInSeconds()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |