math

package
v1.8.9 Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Max

func Max(a, b int) int

Max returns the maximum of two ints

func Max64

func Max64(a, b int64) int64

Max64 returns the maximum of two int64s

func Min

func Min(a, b int) int

Min returns the minimum of two ints

func Min64

func Min64(a, b int64) int64

Min64 returns the minimum of two int64s

Types

type EwmaRate

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

EwmaRate tracks an exponentially weighted moving average of a per-second rate.

func NewEWMARate

func NewEWMARate(alpha float64, interval time.Duration) *EwmaRate

func (*EwmaRate) Add

func (r *EwmaRate) Add(delta int64)

func (*EwmaRate) Inc

func (r *EwmaRate) Inc()

Inc counts one event.

func (*EwmaRate) Rate

func (r *EwmaRate) Rate() float64

Rate returns the per-second rate.

func (*EwmaRate) Tick

func (r *EwmaRate) Tick()

Tick assumes to be called every r.interval.

Jump to

Keyboard shortcuts

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