stats

package
v0.0.0-...-3ba885b Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package stats provides various statistical operations and algorithms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMB

func FormatMB(v int, period time.Duration) string

func Import

func Import(named map[string]uint64)

func LenOf

func LenOf(containerPtr any, mu *sync.RWMutex) func() int

LenOf reads the metric value from the given slice/map/chan.

func RenderHTML

func RenderHTML() ([]byte, error)

func UTest

func UTest(old, new *Sample) (pval float64, err error)

Mann-Whitney U test.

Types

type AverageParameter

type AverageParameter interface {
	time.Duration
}

type AverageValue

type AverageValue[T AverageParameter] struct {
	// contains filtered or unexported fields
}

func (*AverageValue[T]) Save

func (av *AverageValue[T]) Save(val T)

func (*AverageValue[T]) Value

func (av *AverageValue[T]) Value() T

type Distribution

type Distribution struct{}

Distribution says to collect/visualize histogram of individual sample distributions.

type Graph

type Graph string

Graph allows to combine multiple related metrics on a single graph.

const NoGraph Graph = ""

NoGraph says to not visualize the metric as a graph.

type Level

type Level int

Level controls if the metric should be printed to console in periodic heartbeat logs, or showed on the simple web interface, or showed in the expert interface only.

const (
	All Level = iota
	Simple
	Console
)
type Link string

Link adds a hyperlink to metric name.

type Prometheus

type Prometheus string

Prometheus exports the metric to Prometheus under the given name.

type Rate

type Rate struct{}

Rate says to collect/visualize metric rate per unit of time rather then total value.

type Sample

type Sample struct {
	Xs     []float64
	Sorted bool
}

Sample represents a single sample - set of data points collected during an experiment.

func (*Sample) Copy

func (s *Sample) Copy() *Sample

func (*Sample) Median

func (s *Sample) Median() float64

func (*Sample) Percentile

func (s *Sample) Percentile(p float64) float64

func (*Sample) RemoveOutliers

func (s *Sample) RemoveOutliers() *Sample

Remove outliers by the Tukey's fences method.

func (*Sample) Sort

func (s *Sample) Sort()

type StackedGraph

type StackedGraph string

StackedGraph is like Graph, but shows metrics on a stacked graph.

type UI

type UI struct {
	Name  string
	Desc  string
	Link  string
	Level Level
	Value string
	V     int
}

func Collect

func Collect(level Level) []UI

type Val

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

func Create

func Create(name, desc string, opts ...any) *Val

func (*Val) Add

func (v *Val) Add(val int)

func (*Val) Val

func (v *Val) Val() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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