com.netflix.util
Class MeasuredRate

java.lang.Object
  extended by com.netflix.util.MeasuredRate

public class MeasuredRate
extends java.lang.Object

Utility class for getting a count per last X milliseconds


Constructor Summary
MeasuredRate(long sampleInterval)
           
 
Method Summary
 long getCount()
          Returns the count in the last sample interval
 long getCurrentCount()
          Returns the count in the current sample interval which will be incomplete.
 void increment()
          Increments the count in the current sample interval.
static void main(java.lang.String[] args)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MeasuredRate

public MeasuredRate(long sampleInterval)
Parameters:
sampleInterval - in milliseconds
Method Detail

getCount

public long getCount()
Returns the count in the last sample interval


getCurrentCount

public long getCurrentCount()
Returns the count in the current sample interval which will be incomplete. If you are looking for accurate counts/interval - use getCount() instead.


increment

public void increment()
Increments the count in the current sample interval. If the current interval has exceeded, assigns the current count to the last bucket and zeros out the current bucket


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)