common/DecayCounter: add delta to value for ::get

This resolves a bug where getting the DecayCounter value before one second has
elapsed will result in 0 always being returned. This is because ::hit will add
to the delta, not the value. The delta is added to the value only in the decay
function which only processes changes after 1 second has elapsed since the last
decay.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
Patrick Donnelly 2017-04-17 22:28:13 -04:00
parent 5f49379afb
commit b2f53b85c3
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB

View File

@ -73,7 +73,7 @@ public:
double get(utime_t now, const DecayRate& rate) {
decay(now, rate);
return val;
return val+delta;
}
double get_last() {