Documentation ¶
Overview ¶
Package cm implements the Cormode-Muthukrishnan algorithm for computing biased quantiles over data streams from "Effective Computation of Biased Quantiles over Data Streams" and is largely based on statsite's implementation in C: https://github.com/statsite/statsite/blob/master/src/cm_quantile.c
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options interface { // SetEps sets the desired epsilon for errors. SetEps(value float64) Options // Eps returns the desired epsilon for errors. Eps() float64 // SetCapacity sets the initial heap capacity. SetCapacity(value int) Options // Capacity returns the initial heap capacity. Capacity() int // SetInsertAndCompressEvery sets how frequently the timer values are // inserted into the stream and compressed to reduce write latency for // high frequency timers. SetInsertAndCompressEvery(value int) Options // InsertAndCompressEvery returns how frequently the timer values are // inserted into the stream and compressed to reduce write latency for // high frequency timers. InsertAndCompressEvery() int // SetFlushEvery sets how frequently the underlying stream is flushed // to reduce processing time when computing aggregated statistics from // the stream. SetFlushEvery(value int) Options // FlushEvery returns how frequently the underlying stream is flushed // to reduce processing time when computing aggregated statistics from // the stream. FlushEvery() int // SetStreamPool sets the stream pool. SetStreamPool(value StreamPool) Options // StreamPool returns the stream pool. StreamPool() StreamPool // SetSamplePool sets the sample pool. SetSamplePool(value SamplePool) Options // SamplePool returns the sample pool. SamplePool() SamplePool // SetFloatsPool sets the floats pool. SetFloatsPool(value pool.FloatsPool) Options // FloatsPool returns the floats pool. FloatsPool() pool.FloatsPool // Validate validates the options. Validate() error }
Options represent various options for computing quantiles.
type Sample ¶
type Sample struct {
// contains filtered or unexported fields
}
Sample represents a sampled value.
type SamplePool ¶
type SamplePool interface { // Init initializes the pool. Init() // Get gets a sample from the pool. Get() *Sample // Put returns a sample to the pool. Put(sample *Sample) }
SamplePool is a pool of samples.
func NewSamplePool ¶
func NewSamplePool(opts pool.ObjectPoolOptions) SamplePool
NewSamplePool creates a new pool for samples.
type Stream ¶
type Stream interface { // Add adds a sample value. Add(value float64) // Flush flushes the internal buffer. Flush() // Min returns the minimum value. Min() float64 // Max returns the maximum value. Max() float64 // Quantile returns the quantile value. Quantile(q float64) float64 // Close closes the stream. Close() // ResetSetData resets the stream and sets data. ResetSetData(quantiles []float64) }
Stream represents a data sample stream for floating point numbers.
type StreamPool ¶
type StreamPool interface { // Init initializes the pool. Init(alloc StreamAlloc) // Get provides a stream from the pool. Get() Stream // Put returns a stream to the pool. Put(value Stream) }
StreamPool provides a pool for streams.
func NewStreamPool ¶
func NewStreamPool(opts pool.ObjectPoolOptions) StreamPool
NewStreamPool creates a new pool for streams.
Click to show internal directories.
Click to hide internal directories.