Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 3483418bd -> 4133c74a9


Fixing double division and rounding.

Patch by Per Otterstrom; reviewed by dbrosius for CASSANDRA-11752


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ac24b88e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ac24b88e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ac24b88e

Branch: refs/heads/cassandra-3.0
Commit: ac24b88e56275583b71bd6a1feba443e05e88c39
Parents: 6eff082
Author: Per Otterstrom <per.otterst...@ericsson.com>
Authored: Tue Aug 30 22:33:49 2016 -0400
Committer: Dave Brosius <dbros...@mebigfatguy.com>
Committed: Tue Aug 30 22:33:49 2016 -0400

----------------------------------------------------------------------
 .../metrics/DecayingEstimatedHistogramReservoir.java         | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ac24b88e/src/java/org/apache/cassandra/metrics/DecayingEstimatedHistogramReservoir.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/metrics/DecayingEstimatedHistogramReservoir.java
 
b/src/java/org/apache/cassandra/metrics/DecayingEstimatedHistogramReservoir.java
index 14a4366..2458164 100644
--- 
a/src/java/org/apache/cassandra/metrics/DecayingEstimatedHistogramReservoir.java
+++ 
b/src/java/org/apache/cassandra/metrics/DecayingEstimatedHistogramReservoir.java
@@ -179,7 +179,7 @@ public class DecayingEstimatedHistogramReservoir implements 
Reservoir
 
         try
         {
-            decayingBuckets.getAndAdd(index, forwardDecayWeight(now));
+            decayingBuckets.getAndAdd(index, 
Math.round(forwardDecayWeight(now)));
         }
         finally
         {
@@ -189,9 +189,9 @@ public class DecayingEstimatedHistogramReservoir implements 
Reservoir
         buckets.getAndIncrement(index);
     }
 
-    private long forwardDecayWeight(long now)
+    private double forwardDecayWeight(long now)
     {
-        return Math.round(Math.exp(((now - decayLandmark) / 1000L) / 
MEAN_LIFETIME_IN_S));
+        return Math.exp(((now - decayLandmark) / 1000L) / MEAN_LIFETIME_IN_S);
     }
 
     /**
@@ -270,7 +270,7 @@ public class DecayingEstimatedHistogramReservoir implements 
Reservoir
 
             try
             {
-                final long rescaleFactor = forwardDecayWeight(now);
+                final double rescaleFactor = forwardDecayWeight(now);
                 decayLandmark = now;
 
                 final int bucketCount = decayingBuckets.length();

Reply via email to