stats

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CircularBuffer

type CircularBuffer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CircularBuffer is a simple circular buffer to hold recent values.

func NewCircularBuffer

func NewCircularBuffer(size int) *CircularBuffer

NewCircularBuffer creates a new CircularBuffer of the given size.

func (*CircularBuffer) Add

func (cb *CircularBuffer) Add(value int)

Add adds a new value to the circular buffer and updates the average.

func (*CircularBuffer) Average

func (cb *CircularBuffer) Average() int

Average returns the average of the values in the circular buffer.

Jump to

Keyboard shortcuts

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