Class QueryProfilerTimer


  • class QueryProfilerTimer
    extends java.lang.Object
    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();
      }
      
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long count  
      private boolean doTiming  
      private long lastCount  
      private long start  
      private long timing  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getApproximateTiming()
      Return an approximation of the total time spent between consecutive calls of #start and #stop.
      long getCount()
      Return the number of times that start() has been called.
      (package private) long nanoTime()
      pkg-private for testing
      void start()
      Start the timer.
      void stop()
      Stop the timer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • doTiming

        private boolean doTiming
      • timing

        private long timing
      • count

        private long count
      • lastCount

        private long lastCount
      • start

        private long start
    • Constructor Detail

      • QueryProfilerTimer

        QueryProfilerTimer()
    • 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 that start() has been called.
      • getApproximateTiming

        public final long getApproximateTiming()
        Return an approximation of the total time spent between consecutive calls of #start and #stop.