public class RateTracker extends Object implements Closeable
Constructor and Description |
---|
RateTracker(int validTimeWindowInMils,
int numBuckets)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
notify(long count)
Notify the tracker upon new arrivals.
|
double |
reportRate()
Get report rate.
|
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.public void notify(long count)
count
- number of arrivalspublic double reportRate()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2023 The Apache Software Foundation. All rights reserved.