Documentation ¶
Overview ¶
Counter is a counter without rate information.
Datapoint tracks a fluctuating value with average. Thread-safe.
RateCounter is a value/running/max counter with averaging.
Index ¶
- Variables
- func InitAverager(averagerp *Averager, size int)
- func NewRunner() (run *runner)
- type Averager
- type Counter
- func (cn *Counter) Add(delta int64) (counter parl.Counter)
- func (cn *Counter) Clone() (counterValues parl.CounterValues)
- func (cn *Counter) CloneReset(stopRateCounters bool) (counterValues parl.CounterValues)
- func (cn *Counter) Dec() (counter parl.Counter)
- func (cn *Counter) Get() (value, running, max uint64)
- func (cn *Counter) Inc() (counter parl.Counter)
- func (cn *Counter) Value() (value uint64)
- type Counters
- func (cs *Counters) DatapointMax(name parl.CounterID) (datapointMax uint64)
- func (cs *Counters) DatapointMin(name parl.CounterID) (datapointMin uint64)
- func (cs *Counters) DatapointValue(name parl.CounterID) (datapointValue uint64)
- func (cs *Counters) Exists(name parl.CounterID) (exists bool)
- func (cs *Counters) Get(name parl.CounterID) (value, running, max uint64)
- func (cs *Counters) GetCounters() (list []parl.CounterID, m map[parl.CounterID]any)
- func (cs *Counters) GetDatapoint(name parl.CounterID) (value, max, min uint64, isValid bool, average float64, n uint64)
- func (cs *Counters) GetOrCreateCounter(name parl.CounterID, period ...time.Duration) (counter parl.Counter)
- func (cs *Counters) GetOrCreateDatapoint(name parl.CounterID, period time.Duration) (datapoint parl.Datapoint)
- func (cs *Counters) Rates(name parl.CounterID) (rates map[parl.RateType]int64)
- func (cs *Counters) ResetCounters(stopRateCounters bool)
- func (cs *Counters) Value(name parl.CounterID) (value uint64)
- type Datapoint
- func (dt *Datapoint) CloneDatapoint() (datapoint parl.Datapoint)
- func (dt *Datapoint) CloneDatapointReset() (datapoint parl.Datapoint)
- func (dt *Datapoint) DatapointMax() (max uint64)
- func (dt *Datapoint) DatapointMin() (min uint64)
- func (dt *Datapoint) DatapointValue() (value uint64)
- func (dt *Datapoint) GetDatapoint() (value, max, min uint64, isValid bool, average float64, n uint64)
- func (dt *Datapoint) SetValue(value uint64) (datapoint parl.Datapoint)
- type Rate
- type RateCounter
- type RateRunner
- type RateRunnerTask
- type RateType
Constants ¶
This section is empty.
Variables ¶
View Source
var CountersFactory parl.CountersFactory = &countersFactory{}
Functions ¶
func InitAverager ¶
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a counter without rate information. Thread-safe.
- value: monotonically increasing affected by method Inc
- running: value of Inc - Dec
- max: the highest historical value of running
- Counter implements parl.Counter and parl.CounterValues.
Note: because Counter uses atomics and not lock, data integrity is not guaranteed or achievable. Data is valid and consistent but may be of progressing revision.
func (*Counter) Clone ¶
func (cn *Counter) Clone() (counterValues parl.CounterValues)
func (*Counter) CloneReset ¶
func (cn *Counter) CloneReset(stopRateCounters bool) (counterValues parl.CounterValues)
type Counters ¶
type Counters struct { RateRunner // contains filtered or unexported fields }
Counters is a container for counters, rate-counters and datapoints. Thread-Safe.
- a counter is Inc-Dec with: value running max
- a rate-counter is a counter with addtional measuring over short time periods:
- — value: rate of increase: current/max/average
- — running: rate up or down, max increase/decrease rate,
func (*Counters) DatapointMax ¶ added in v0.4.41
func (*Counters) DatapointMin ¶ added in v0.4.41
func (*Counters) DatapointValue ¶ added in v0.4.41
func (*Counters) GetCounters ¶
func (*Counters) GetDatapoint ¶ added in v0.4.41
func (*Counters) GetOrCreateCounter ¶
func (*Counters) GetOrCreateDatapoint ¶
func (*Counters) ResetCounters ¶
type Datapoint ¶
type Datapoint struct {
// contains filtered or unexported fields
}
Datapoint tracks a fluctuating value with average. Thread-safe.
func (*Datapoint) CloneDatapoint ¶
func (*Datapoint) CloneDatapointReset ¶
func (*Datapoint) DatapointMax ¶
func (*Datapoint) DatapointMin ¶
func (*Datapoint) DatapointValue ¶
func (*Datapoint) GetDatapoint ¶
type RateCounter ¶
type RateCounter struct { Counter // value-running-max atomic-access container // contains filtered or unexported fields }
RateCounter is a value/running/max counter with averaging.
- rate of increase, maximum and average rate of increase in value
- rate of increase, maximum increase and decrease rates and average of value
func (*RateCounter) Do ¶
func (rc *RateCounter) Do()
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()
}
Click to show internal directories.
Click to hide internal directories.