public class RateTracker extends Object
This class is a utility to track the rate of something.
Constructor and Description |
---|
RateTracker(int validTimeWindowInMils,
int numBuckets) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
notify(long count)
Notify the tracker upon new arrivals
|
double |
reportRate() |
public RateTracker(int validTimeWindowInMils, int numBuckets)
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.Copyright © 2019 The Apache Software Foundation. All Rights Reserved.