Documentation ¶
Overview ¶
Package trivialstats implements some basic statistic functions that I keep reimplementing. Notably: counters that track min/max/average, and an implementation of exact percentiles. More sophisticated applications should use ddsketch: https://github.com/DataDog/sketches-go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AverageMinMax ¶
type AverageMinMax struct {
// contains filtered or unexported fields
}
AverageMinMax computes the average, minimum and maximum of a set of values.
func NewAverageMinMax ¶
func NewAverageMinMax() *AverageMinMax
NewAverageMinMax returns a new empty AverageMinMax.
func (*AverageMinMax) Average ¶
func (a *AverageMinMax) Average() float64
Average returns the average of all records.
func (*AverageMinMax) Count ¶
func (a *AverageMinMax) Count() int64
Count returns the count of records.
func (*AverageMinMax) Max ¶
func (a *AverageMinMax) Max() int64
Max returns the maximum of all records.
func (*AverageMinMax) Min ¶
func (a *AverageMinMax) Min() int64
Min returns the minimum of all records.
func (*AverageMinMax) Record ¶
func (a *AverageMinMax) Record(value int64)
Record adds value to the set.
type Distribution ¶
type Distribution struct {
// contains filtered or unexported fields
}
Distribution records all samples to provide exact percentiles. More serious applications should use https://github.com/DataDog/sketches-go.
func NewDistribution ¶
func NewDistribution() *Distribution
func (*Distribution) Add ¶
func (d *Distribution) Add(sample int64)
func (*Distribution) Stats ¶
func (d *Distribution) Stats() DistributionStats