forked from I2P_Developers/i2p.i2p
more use of the computeAverages method
This commit is contained in:
@ -422,6 +422,8 @@ public class Rate {
|
||||
public synchronized void computeAverages(RateAverages out, boolean useLifetime) {
|
||||
|
||||
final long total = _currentEventCount + _lastEventCount;
|
||||
out.setTotalEventCount(total);
|
||||
|
||||
if (total <= 0) {
|
||||
final double avg = useLifetime ? getAvgOrLifetimeAvg() : getAverageValue();
|
||||
out.setAverage(avg);
|
||||
|
@ -8,11 +8,13 @@ package net.i2p.stat;
|
||||
public class RateAverages {
|
||||
|
||||
private double average, current, last;
|
||||
private long totalEventCount;
|
||||
|
||||
public void reset() {
|
||||
average = 0;
|
||||
current = 0;
|
||||
last = 0;
|
||||
totalEventCount = 0;
|
||||
}
|
||||
|
||||
public double getAverage() {
|
||||
@ -39,4 +41,12 @@ public class RateAverages {
|
||||
this.last = last;
|
||||
}
|
||||
|
||||
public long getTotalEventCount() {
|
||||
return totalEventCount;
|
||||
}
|
||||
|
||||
public void setTotalEventCount(long totalEventCount) {
|
||||
this.totalEventCount = totalEventCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user