Class ThreadBarrier.BarrierTimer
- java.lang.Object
-
- org.elasticsearch.common.util.concurrent.ThreadBarrier.BarrierTimer
-
- All Implemented Interfaces:
java.lang.Runnable
- Enclosing class:
- ThreadBarrier
public static class ThreadBarrier.BarrierTimer extends java.lang.Object implements java.lang.Runnable
A Barrier action to be used in conjunction withThreadBarrier
to measure performance between barrier awaits. This runnable will execute when the barrier is tripped. Make sure to reset() the timer before next Measurement.
-
-
Constructor Summary
Constructors Constructor Description BarrierTimer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
-
-
-
Method Detail
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
reset
public void reset()
resets (clears) this timer before next execution.
-
getTimeInNanos
public long getTimeInNanos()
Returns the elapsed time between two successive barrier executions.- Returns:
- elapsed time in nanoseconds.
-
getTimeInSeconds
public double getTimeInSeconds()
Returns the elapsed time between two successive barrier executions.- Returns:
- elapsed time in seconds.
-
-