forked from I2P_Developers/i2p.i2p
* Stats: Add API methods for zero duration, for efficiency
This commit is contained in:
@ -46,6 +46,17 @@ public class RateStat {
|
||||
r.addData(value, eventDuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all of the rates for the various periods with the given value.
|
||||
* Zero duration.
|
||||
* @since 0.8.10
|
||||
*/
|
||||
public void addData(long value) {
|
||||
if (_statLog != null) _statLog.addData(_groupName, _statName, value, 0);
|
||||
for (Rate r: _rates.values())
|
||||
r.addData(value);
|
||||
}
|
||||
|
||||
/** coalesce all the stats */
|
||||
public void coalesceStats() {
|
||||
for (Rate r: _rates.values()){
|
||||
|
@ -150,6 +150,16 @@ public class StatManager {
|
||||
if (stat != null) stat.addData(data, eventDuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the given rate statistic, taking note that the given data point was received (and recalculating all rates).
|
||||
* Zero duration.
|
||||
* @since 0.8.10
|
||||
*/
|
||||
public void addRateData(String name, long data) {
|
||||
RateStat stat = _rateStats.get(name); // unsynchronized
|
||||
if (stat != null) stat.addData(data);
|
||||
}
|
||||
|
||||
private int coalesceCounter;
|
||||
/** every this many minutes for frequencies */
|
||||
private static final int FREQ_COALESCE_RATE = 9;
|
||||
|
Reference in New Issue
Block a user