Code example for Stopwatch

Methods: elapsed

0
      return new SleepingStopwatch() { 
        final Stopwatch stopwatch = Stopwatch.createStarted();
 
        @Override 
        long readMicros() { 
          return stopwatch.elapsed(MICROSECONDS);
        } 
 
        @Override 
        void sleepMicrosUninterruptibly(long micros) {
          if (micros > 0) {
            Uninterruptibles.sleepUninterruptibly(micros, MICROSECONDS);
          } 
        } 
      }; 
    } 
  } 
 
  private static int checkPermits(int permits) {
    checkArgument(permits > 0, "Requested permits (%s) must be positive", permits);
Stop searching for code, let great code find you!  Add Codota to your java IDE