2006-02-24 jrandom
* Rounding calculation cleanup in the stats, and avoid an uncontested mutex (thanks ripple!) * SSU handshake cleanup to help force incompatible peers to stop nagging us by both not giving them an updated reference to us and by dropping future handshake packets from them.
This commit is contained in:
@ -187,10 +187,10 @@ public class Rate {
|
||||
// ok ok, lets coalesce
|
||||
|
||||
// how much were we off by? (so that we can sample down the measured values)
|
||||
double periodFactor = measuredPeriod / _period;
|
||||
_lastTotalValue = (_currentTotalValue == 0 ? 0.0D : _currentTotalValue / periodFactor);
|
||||
_lastEventCount = (_currentEventCount == 0 ? 0L : (long) (_currentEventCount / periodFactor));
|
||||
_lastTotalEventTime = (_currentTotalEventTime == 0 ? 0L : (long) (_currentTotalEventTime / periodFactor));
|
||||
double periodFactor = measuredPeriod / (double)_period;
|
||||
_lastTotalValue = _currentTotalValue / periodFactor;
|
||||
_lastEventCount = (long) (_currentEventCount / periodFactor);
|
||||
_lastTotalEventTime = (long) (_currentTotalEventTime / periodFactor);
|
||||
_lastCoalesceDate = now;
|
||||
|
||||
if (_lastTotalValue > _extremeTotalValue) {
|
||||
@ -237,10 +237,12 @@ public class Rate {
|
||||
*/
|
||||
public double getLastEventSaturation() {
|
||||
if ((_lastEventCount > 0) && (_lastTotalEventTime > 0)) {
|
||||
double eventTime = (double) _lastTotalEventTime / (double) _lastEventCount;
|
||||
/*double eventTime = (double) _lastTotalEventTime / (double) _lastEventCount;
|
||||
double maxEvents = _period / eventTime;
|
||||
double saturation = _lastEventCount / maxEvents;
|
||||
return saturation;
|
||||
*/
|
||||
return ((double)_lastTotalEventTime) / (double)_period;
|
||||
}
|
||||
|
||||
return 0.0D;
|
||||
|
@ -146,15 +146,15 @@ public class DecayingBloomFilter {
|
||||
for (int i = 0; i < _extenders.length; i++)
|
||||
DataHelper.xor(entry, offset, _extenders[i], 0, _extended, _entryBytes * (i+1), _entryBytes);
|
||||
|
||||
boolean seen = _current.member(_extended);
|
||||
seen = seen || _previous.member(_extended);
|
||||
boolean seen = _current.locked_member(_extended);
|
||||
seen = seen || _previous.locked_member(_extended);
|
||||
if (seen) {
|
||||
_currentDuplicates++;
|
||||
return true;
|
||||
} else {
|
||||
if (addIfNew) {
|
||||
_current.insert(_extended);
|
||||
_previous.insert(_extended);
|
||||
_current.locked_insert(_extended);
|
||||
_previous.locked_insert(_extended);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user