Statistics on a time sequence rate.
Calculates the rate at which the record() method is called
over the configured period, retaining also the total count and maximum
rate achieved.
The implementation keeps a Deque of timestamps for all records for the last time period, so this method is not suitable for large rates unless a small time period is used.
| Modifier and Type | Field and Description |
|---|---|
| private long | |
| private final AutoLock | |
| private long | |
| private final long | |
| private final Deque | |
| private final TimeUnit |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public String | |
| public String | |
| public long | |
| public long | |
| public long | |
| public long | |
| public int | Returns: the number of records in the current periodGet the number of records in the current period. |
| public TimeUnit | |
| public int | |
| public void | |
| public String | |
| private String | |
| private void | |
| private void |
| _count | back to summary |
|---|---|
| private long _count | |
| _lock | back to summary |
|---|---|
| private final AutoLock _lock | |
| _max | back to summary |
|---|---|
| private long _max | |
| _nanoPeriod | back to summary |
|---|---|
| private final long _nanoPeriod | |
| _samples | back to summary |
|---|---|
| private final Deque<Long> _samples | |
| _units | back to summary |
|---|---|
| private final TimeUnit _units | |
| RateStatistic | back to summary |
|---|---|
| public RateStatistic(long period, TimeUnit units) | |
| age | back to summary |
|---|---|
| protected void age(long period, TimeUnit units) | |
| dump | back to summary |
|---|---|
| public String dump() | |
| dump | back to summary |
|---|---|
| public String dump(TimeUnit units) | |
| getCount | back to summary |
|---|---|
| public long getCount() Get the number of samples recorded.
| |
| getMax | back to summary |
|---|---|
| public long getMax() Get the max number of samples per period..
| |
| getOldest | back to summary |
|---|---|
public long getOldest(TimeUnit units)
| |
| getPeriod | back to summary |
|---|---|
| public long getPeriod() | |
| getRate | back to summary |
|---|---|
| public int getRate() Get the number of records in the current period.
| |
| getUnits | back to summary |
|---|---|
| public TimeUnit getUnits() | |
| record | back to summary |
|---|---|
| public int record() Records a sample value.
| |
| reset | back to summary |
|---|---|
| public void reset() Resets the statistics. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| toString | back to summary |
|---|---|
| private String toString(long nanoTime) | |
| update | back to summary |
|---|---|
| private void update() | |
| update | back to summary |
|---|---|
| private void update(long now) | |