faststats

package module
v0.0.0-...-0fc2c5e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2015 License: BSD-2-Clause Imports: 5 Imported by: 18

README

faststats Build Status

faststats is a Go package for calculating various statistical measures in real time. It is intended to be used in online networking applications, where significant overhead just for stats collection is undesirable.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Measure

type Measure interface {
	AddSample(sample float64)
	Value() float64
}

type Percentile

type Percentile struct {
	// contains filtered or unexported fields
}

Percentile implements an efficient percentile calculation of arbitrary float64 samples.

func NewPercentile

func NewPercentile(percentile float64) *Percentile

NewPercentile returns a Percentile with a given threshold.

func NewPercentileWithWindow

func NewPercentileWithWindow(percentile float64, sampleWindow int) *Percentile

NewPercentileWithWindow returns a Percentile with a given threshold and window size (accuracy).

func (*Percentile) AddSample

func (p *Percentile) AddSample(sample float64)

AddSample adds a single float64 sample to the data set. It is not thread-safe, and must not be called in parallel.

func (*Percentile) MarshalJSON

func (p *Percentile) MarshalJSON() ([]byte, error)

func (*Percentile) Value

func (p *Percentile) Value() float64

Value returns the current value at the stored percentile. It is thread-safe, and may be called concurrently with AddSample.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL