Documentation ¶
Overview ¶
Package runningstat implements Knuth and Welford's method for computing the standard deviation.
Index ¶
- type RunningStat
- type Snapshot
- func (s Snapshot) Add(o Snapshot) (sum Snapshot)
- func (s Snapshot) Count() uint64
- func (s Snapshot) Len() uint64
- func (s Snapshot) MarshalJSON() ([]byte, error)
- func (s Snapshot) Max() float64
- func (s Snapshot) Mean() float64
- func (s Snapshot) Min() float64
- func (s Snapshot) Scale(ratio float64) (o Snapshot)
- func (s Snapshot) Stdev() float64
- func (s Snapshot) Sub(o Snapshot) (diff Snapshot)
- func (s *Snapshot) UnmarshalJSON(p []byte) (e error)
- func (s Snapshot) Variance() float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RunningStat ¶
type RunningStat struct {
// contains filtered or unexported fields
}
RunningStat collects statistics and allows computing min, max, mean, and variance. Algorithm comes from https://www.johndcook.com/blog/standard_deviation/ .
func FromPtr ¶
func FromPtr(ptr unsafe.Pointer) (s *RunningStat)
FromPtr converts *C.RunningStat to RunningStat.
func (*RunningStat) Clear ¶
func (s *RunningStat) Clear(enableMinMax bool)
Clear deletes collects data.
func (*RunningStat) Read ¶
func (s *RunningStat) Read() (o Snapshot)
Read returns current counters as Snapshot.
func (*RunningStat) SetSampleRate ¶
func (s *RunningStat) SetSampleRate(q int)
SetSampleRate changes sample rate be once every 2^q inputs.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot contains a snapshot of RunningStat reading.
func (Snapshot) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface.
func (*Snapshot) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface.
Click to show internal directories.
Click to hide internal directories.