/guava/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java
permitsToTime( thresholdPermits) + permitsToTime( availablePermitsAboveThreshold - permitsAboveThresholdToTake) ;
permitsToTime ( availablePermitsAboveThreshold ) + permitsToTime ( availablePermitsAboveThreshold - permitsAboveThresholdToTake ) ;
long storedPermitsToWaitTime(double storedPermits, double permitsToTake) { double availablePermitsAboveThreshold = storedPermits - thresholdPermits; long micros = 0; if (availablePermitsAboveThreshold > 0.0) { double permitsAboveThresholdToTake = min(availablePermitsAboveThreshold, permitsToTake); double length = <extra_id_0> micros = (long) (permitsAboveThresholdToTake * length / 2.0); permitsToTake -= permitsAboveThresholdToTake; } micros += (long) (stableIntervalMicros * permitsToTake); return micros; }