Package org.apache.lucene.sandbox.search
Class QueryProfilerTimer
- java.lang.Object
-
- org.apache.lucene.sandbox.search.QueryProfilerTimer
-
class QueryProfilerTimer extends java.lang.ObjectHelps measure how much time is spent running some methods. Thestart()andstop()methods should typically be called in a try/finally clause withstart()being called right before the try block andstop()being called at the beginning of the finally block:timer.start(); try { // code to time } finally { timer.stop(); }
-
-
Constructor Summary
Constructors Constructor Description QueryProfilerTimer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetApproximateTiming()Return an approximation of the total time spent between consecutive calls of #start and #stop.longgetCount()Return the number of times thatstart()has been called.(package private) longnanoTime()pkg-private for testingvoidstart()Start the timer.voidstop()Stop the timer.
-
-
-
Method Detail
-
nanoTime
long nanoTime()
pkg-private for testing
-
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.
-
getApproximateTiming
public final long getApproximateTiming()
Return an approximation of the total time spent between consecutive calls of #start and #stop.
-
-