uptime

package
v1.4.9 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: BSD-3-Clause Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContinuousFactory

type ContinuousFactory struct{}

ContinuousFactory implements the Factory interface by returning a continuous time meter.

func (ContinuousFactory) New

func (ContinuousFactory) New(halflife time.Duration) Meter

New implements the Factory interface.

type Factory

type Factory interface {
	// New returns a new meter with the provided halflife.
	New(halflife time.Duration) Meter
}

Factory returns new meters.

type IntervalFactory

type IntervalFactory struct{}

IntervalFactory implements the Factory interface by returning an interval based meter.

func (IntervalFactory) New

func (IntervalFactory) New(halflife time.Duration) Meter

New implements the Factory interface.

type Meter

type Meter interface {
	// Start the meter, the read value will be monotonically increasing while
	// the meter is running.
	Start(time.Time)

	// Stop the meter, the read value will be exponentially decreasing while the
	// meter is off.
	Stop(time.Time)

	// Read the current value of the meter, this can be used to approximate the
	// percent of time the meter has been running recently. The definition of
	// recently depends on the halflife of the decay function.
	Read(time.Time) float64
}

Meter tracks a continuous exponential moving average of the % of time this meter has been running.

func NewIntervalMeter

func NewIntervalMeter(halflife time.Duration) Meter

NewIntervalMeter returns a new Meter with the provided halflife

func NewMeter

func NewMeter(halflife time.Duration) Meter

NewMeter returns a new Meter with the provided halflife

Jump to

Keyboard shortcuts

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