Class RateTracker

    • Constructor Detail

      • RateTracker

        public RateTracker​(int validTimeWindowInMils,
                           int numBuckets)
        Constructor.
        Parameters:
        validTimeWindowInMils - events that happened before validTimeWindowInMils are not considered when reporting the rate.
        numBuckets - the number of time sildes to divide validTimeWindows. The more buckets, the smother the reported results will be.
    • Method Detail

      • notify

        public void notify​(long count)
        Notify the tracker upon new arrivals.
        Parameters:
        count - number of arrivals
      • reportRate

        public double reportRate()
        Get report rate.
        Returns:
        the approximate average rate per second.