Package org.opensearch.search.profile
Class Timer
java.lang.Object
org.opensearch.search.profile.Timer
Helps measure how much time is spent running some methods.
The
start()
and stop()
methods should typically be called
in a try/finally clause with start()
being called right before the
try block and stop()
being called at the beginning of the finally
block:
timer.start(); try { // code to time } finally { timer.stop(); }
- Opensearch.internal:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal long
Return an approximation of the total time spent between consecutive calls of #start and #stop.final long
getCount()
Return the number of times thatstart()
has been called.final long
Return the timer start time in nanoseconds.final void
start()
Start the timer.final void
stop()
Stop the timer.
-
Constructor Details
-
Timer
public Timer() -
Timer
public Timer(long timing, long count, long lastCount, long start, long earliestTimerStartTime)
-
-
Method Details
-
start
public final void start()Start the timer. -
stop
public final void stop()Stop the timer. -
getCount
public final long getCount()Return the number of times thatstart()
has been called. -
getEarliestTimerStartTime
public final long getEarliestTimerStartTime()Return the timer start time in nanoseconds. -
getApproximateTiming
public final long getApproximateTiming()Return an approximation of the total time spent between consecutive calls of #start and #stop.
-