Help us shape the future of Go! Take the 2026 Go Developer Survey

statutil

package
v1.3.104 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package statutil pkg/cxo/skyobject/statutil/average.go c2-net-cxo

Package statutil pkg/cxo/skyobject/statutil/statutil.go c2-net-cxo

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Amount

type Amount uint32

An Amount represents amount of items. The Amount based on uint32

func (Amount) String

func (a Amount) String() (s string)

String implements fmt.String interface and returns human-readable string represents the Amount. Prefixes for the Amount means 1000. E.g. 1k is 1000 items

type Duration

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

Duration represents rolling (moving) average of time.Duration

func NewDuration

func NewDuration(n int) (d *Duration)

NewDuration creates new Duration using given amount of samples. It panics if the amount is zero or less

func (*Duration) Add

func (d *Duration) Add(dur time.Duration) (avg time.Duration)

Add a time.Duration to the Duration. And get new average value back

func (*Duration) AddStartTime

func (d *Duration) AddStartTime(tp time.Time) (avg time.Duration)

AddStartTime is Add(time.Now().Sub(tp))

func (*Duration) Value

func (d *Duration) Value() time.Duration

Value returns current average Duration

type Float

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

Float represents rolling (moving) average of float64

func NewFloat

func NewFloat(n int) (f *Float)

NewFloat creates new Float using given amount of samples. It panics if the amount is zero or less

func (*Float) Add

func (f *Float) Add(val float64) (avg float64)

Add a float64 to the Float. And get new average value back

func (*Float) Value

func (f *Float) Value() float64

Value returns current average flaot64

type Volume

type Volume uint32

A Volume represents size of an object or many objects in bytes. The Volume based on uint32

func (Volume) String

func (v Volume) String() (s string)

String implements fmt.String interface and returns human-readable string represents the Volume. Prefixes for the Volume means 1024 (instad of 1000). E.g. 1kB is 1024B

Jump to

Keyboard shortcuts

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