counter

package
v0.4.30 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: ISC Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CountersFactory parl.CountersFactory = &countersFactory{}

Functions

func InitAverager

func InitAverager(averagerp *Averager, size int)

func NewRunner

func NewRunner() (run *runner)

Types

type Averager

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

func (*Averager) Add

func (av *Averager) Add(value uint64) (average float64)

type Counter

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

Counter is a counter without rate information. Counter implements parl.Couter and parl.CounterValues. Counter is thread-safe

func (*Counter) Add

func (cn *Counter) Add(delta int64) (counter parl.Counter)

func (*Counter) Clone

func (cn *Counter) Clone() (counterValues parl.CounterValues)

func (*Counter) CloneReset

func (cn *Counter) CloneReset(stopRateCounters bool) (counterValues parl.CounterValues)

func (*Counter) Dec

func (cn *Counter) Dec() (counter parl.Counter)

func (*Counter) Get

func (cn *Counter) Get() (value uint64, running uint64, max uint64)

func (*Counter) Inc

func (cn *Counter) Inc() (counter parl.Counter)

func (*Counter) Max

func (cn *Counter) Max() (max uint64)

func (*Counter) Running

func (cn *Counter) Running() (running uint64)

func (*Counter) Value

func (cn *Counter) Value() (value uint64)

type Counters

type Counters struct {
	RateRunner
	// contains filtered or unexported fields
}

func (*Counters) GetCounters

func (cs *Counters) GetCounters() (list []parl.CounterID, m map[parl.CounterID]any)

func (*Counters) GetOrCreateCounter

func (cs *Counters) GetOrCreateCounter(name parl.CounterID, period ...time.Duration) (counter parl.Counter)

func (*Counters) GetOrCreateDatapoint

func (cs *Counters) GetOrCreateDatapoint(name parl.CounterID, period time.Duration) (datapoint parl.Datapoint)

func (*Counters) ResetCounters

func (cs *Counters) ResetCounters(stopRateCounters bool)

type Datapoint

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

Datapoint is TODO 221210 Datapoint is thread-safe

func (*Datapoint) CloneDatapoint

func (dt *Datapoint) CloneDatapoint() (datapoint parl.Datapoint)

func (*Datapoint) CloneDatapointReset

func (dt *Datapoint) CloneDatapointReset() (datapoint parl.Datapoint)

func (*Datapoint) DatapointMax

func (dt *Datapoint) DatapointMax() (max uint64)

func (*Datapoint) DatapointMin

func (dt *Datapoint) DatapointMin() (min uint64)

func (*Datapoint) DatapointValue

func (dt *Datapoint) DatapointValue() (value uint64)

func (*Datapoint) GetDatapoint

func (dt *Datapoint) GetDatapoint() (value, max, min uint64, isValid bool, average float64, n uint64)

func (*Datapoint) SetValue

func (dt *Datapoint) SetValue(value uint64) (datapoint parl.Datapoint)

SetValue records a new datapoint value

type Rate

type Rate struct {
	RateType // String()
	// contains filtered or unexported fields
}

func (*Rate) Clone

func (rt *Rate) Clone() (rate parl.Rate)

func (*Rate) Delta

func (rt *Rate) Delta() (delta uint64)

func (*Rate) Duration

func (rt *Rate) Duration() (duration time.Duration)

func (*Rate) HasValue

func (rt *Rate) HasValue() (hasValue bool)

type RateCounter

type RateCounter struct {
	Counter
	// contains filtered or unexported fields
}

func (*RateCounter) Do

func (rc *RateCounter) Do()

func (*RateCounter) Rates

func (rc *RateCounter) Rates() (rates map[parl.RateType]int64)

type RateRunner

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

func NewRateRunner

func NewRateRunner(g0 parl.GoGen) (rr *RateRunner)

func (*RateRunner) AddTask

func (rr *RateRunner) AddTask(period time.Duration, task RateRunnerTask)

type RateRunnerTask

type RateRunnerTask interface {
	Do()
}

type RateType

type RateType parl.RateType

func (RateType) String

func (rt RateType) String() (s string)

Jump to

Keyboard shortcuts

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