stat

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hist

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

Hist is a histogram.

func NewHist

func NewHist[T comparable](bins uint) *Hist

NewHist creates a new histogram. bins is the number of bins in the histogram.

func NewLogHist

func NewLogHist[T comparable](bins uint) *Hist

NewLogHist creates a new histogram with log10 bins. bins is the number of bins in the histogram.

func (*Hist) Add

func (h *Hist) Add(value int)

Add adds a value to the histogram.

func (*Hist) AddBatch

func (h *Hist) AddBatch(values ...int)

AddBatch adds multiple values to the histogram.

func (*Hist) All

func (h *Hist) All() iter.Seq2[int, int]

All returns an iterator over the histogram. The iterator yields the bin value and the count.

func (*Hist) Histogram

func (h *Hist) Histogram() map[int]int

Histogram returns the histogram. The keys are the bin values and the values are the counts.

func (*Hist) Len

func (h *Hist) Len() int

Len returns the number of values in the histogram.

func (*Hist) Stat

func (h *Hist) Stat() (min, max, avg, median int)

Stat returns the min, max, avg and median of the histogram.

Jump to

Keyboard shortcuts

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