From: Patrick Donnelly Date: Tue, 18 Apr 2017 02:28:13 +0000 (-0400) Subject: common/DecayCounter: add delta to value for ::get X-Git-Tag: v12.0.3~38^2~28 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b2f53b85c3174c82a3a7487dd56ab0ce16af6f82;p=ceph.git 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 --- diff --git a/src/common/DecayCounter.h b/src/common/DecayCounter.h index 4d735fd99daa..357b0970ffaa 100644 --- a/src/common/DecayCounter.h +++ b/src/common/DecayCounter.h @@ -73,7 +73,7 @@ public: double get(utime_t now, const DecayRate& rate) { decay(now, rate); - return val; + return val+delta; } double get_last() {