Copyright | (c) Josh Bohde 2015 |
---|---|
License | GPL-3 |
Maintainer | josh@joshbohde.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
A Haskell implementation of HdrHistogram. It allows storing counts of observed values within a range, while maintaining precision to a configurable number of significant digits.
The mutable histogram allows only writes, and conversion to and from pure histograms. It follows the original implementation, and has similar performance characteristics. Current recording benchmarks take about 9ns, and allocates 16 bytes.
- data Histogram s c value count = Histogram {
- _config :: HistogramConfig value
- totalCount :: MutVar s count
- counts :: MVector s count
- new :: forall m config a count. (PrimMonad m, HasConfig config, Integral a, FiniteBits a, Unbox count, Integral count) => m (Histogram (PrimState m) config a count)
- fromConfig :: (PrimMonad m, Unbox count, Integral count) => Tagged c (HistogramConfig value) -> m (Histogram (PrimState m) c value count)
- record :: (Integral value, Integral count, FiniteBits value, Unbox count, PrimMonad m) => Histogram (PrimState m) c value count -> value -> m ()
- recordValues :: (Integral value, Integral count, FiniteBits value, Unbox count, PrimMonad m) => Histogram (PrimState m) config value count -> value -> count -> m ()
- freeze :: (Unbox count, PrimMonad m) => Histogram (PrimState m) config value count -> m (Histogram config value count)
- unsafeFreeze :: (Unbox count, PrimMonad m) => Histogram (PrimState m) config value count -> m (Histogram config value count)
- thaw :: (Unbox count, PrimMonad m) => Histogram config value count -> m (Histogram (PrimState m) config value count)
- unsafeThaw :: (Unbox count, PrimMonad m) => Histogram config value count -> m (Histogram (PrimState m) config value count)
- data Config lowest highest sig
- class HasConfig s
Histogram
data Histogram s c value count Source #
A mutable Histogram
Histogram | |
|
new :: forall m config a count. (PrimMonad m, HasConfig config, Integral a, FiniteBits a, Unbox count, Integral count) => m (Histogram (PrimState m) config a count) Source #
Construct a Histogram
fromConfig :: (PrimMonad m, Unbox count, Integral count) => Tagged c (HistogramConfig value) -> m (Histogram (PrimState m) c value count) Source #
Construct a Histogram
from the given HistogramConfig
. In this
case c
is a phantom type.
Writing
record :: (Integral value, Integral count, FiniteBits value, Unbox count, PrimMonad m) => Histogram (PrimState m) c value count -> value -> m () Source #
Record value single value to the Histogram
recordValues :: (Integral value, Integral count, FiniteBits value, Unbox count, PrimMonad m) => Histogram (PrimState m) config value count -> value -> count -> m () Source #
Record a multiple instances of a value value to the Histogram
Converting
freeze :: (Unbox count, PrimMonad m) => Histogram (PrimState m) config value count -> m (Histogram config value count) Source #
unsafeFreeze :: (Unbox count, PrimMonad m) => Histogram (PrimState m) config value count -> m (Histogram config value count) Source #
thaw :: (Unbox count, PrimMonad m) => Histogram config value count -> m (Histogram (PrimState m) config value count) Source #
unsafeThaw :: (Unbox count, PrimMonad m) => Histogram config value count -> m (Histogram (PrimState m) config value count) Source #