hist12h

package
v0.0.0-...-f7596a8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 3 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Quantile

func Quantile(data []uint32, q float64, total uint32) int

quantile q means what's the value v so that all q of the values have value <= v TODO since we typically get 99%, 99.9%, 75%, etc. it should be faster to count the other way

Types

type Hist12h

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

Hist12h is optimized for measurements between 500ms and 12h

func New

func New() Hist12h

func (*Hist12h) AddDuration

func (h *Hist12h) AddDuration(value time.Duration)

adds to the right bucket with a copy of the searchBucket function below, to enforce inlining.

func (*Hist12h) Report

func (h *Hist12h) Report(data []uint32) (Report, bool)

ok can be false for two reasons: (in either case, we can't compute the summaries) * the total count was 0 * the total count overflowed (but we set to 1 so you can tell the difference)

func (*Hist12h) Snapshot

func (h *Hist12h) Snapshot() []uint32

Snapshot returns a snapshot of the data and resets internal state

type Report

type Report struct {
	Min    uint32 // in millis
	Mean   uint32 // in millis
	Median uint32 // in millis
	P75    uint32 // in millis
	P90    uint32 // in millis
	Max    uint32 // in millis
	Count  uint32
}

if count is 0 then there was no input, so statistical summaries are invalid

Jump to

Keyboard shortcuts

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