]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/DecayCounter: add delta to value for ::get
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 18 Apr 2017 02:28:13 +0000 (22:28 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 18 Apr 2017 02:57:34 +0000 (22:57 -0400)
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>
src/common/DecayCounter.h

index 4d735fd99daae7cb97358f674fba5e1520432630..357b0970ffaaa102f7efaba15ce8cc2c192750b2 100644 (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() {