metrics 0.3.0.1 → 0.3.0.2
raw patch · 2 files changed
+5/−5 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
metrics.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: metrics-version: 0.3.0.1+version: 0.3.0.2 synopsis: High-performance application metric tracking description: A port of Coda Hale's excellent metrics library for the JVM
src/Data/Metrics/Histogram/Internal.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE BangPatterns #-} -- | The pure interface for histograms. -- This module is typically not as useful as the stateful implementation -- since reservoir updates require retrieving the current time.@@ -116,11 +117,10 @@ calculateVariance c v = if c <= 1 then 0 else v / (fromIntegral c - 1) updateVariance :: Int -> Double -> (Double, Double) -> (Double, Double)-updateVariance _ c (-1, y) = (c, 0)+updateVariance _ !c (-1, y) = (c, 0) updateVariance count c (x, y) = (l, r) where c' = fromIntegral count diff = c - x- l = x + diff / c'- r = y + diff * (c - l)-+ !l = x + diff / c'+ !r = y + diff * (c - l)