measurements

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2018 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExponentialAverageMeasurement

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

ExponentialAverageMeasurement is an exponential average measurement implementation.

func NewExponentialAverageMeasurement

func NewExponentialAverageMeasurement(
	window int,
	warmupWindow int,
) *ExponentialAverageMeasurement

NewExponentialAverageMeasurement will create a new ExponentialAverageMeasurement

func (*ExponentialAverageMeasurement) Add

Add a single sample and update the internal state.

func (*ExponentialAverageMeasurement) Get

Get the current value.

func (*ExponentialAverageMeasurement) Reset

func (m *ExponentialAverageMeasurement) Reset()

Reset the internal state as if no samples were ever added.

func (*ExponentialAverageMeasurement) String

func (*ExponentialAverageMeasurement) Update

func (m *ExponentialAverageMeasurement) Update(operation func(value float64) float64)

Update will update the value given an operation function

type ImmutableSampleWindow

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

ImmutableSampleWindow is used to track immutable samples atomically.

func NewDefaultImmutableSampleWindow

func NewDefaultImmutableSampleWindow() *ImmutableSampleWindow

NewDefaultImmutableSampleWindow will create a new ImmutableSampleWindow with defaults

func NewImmutableSampleWindow

func NewImmutableSampleWindow(
	startTime int64,
	minRTT int64,
	sum int64,
	maxInFlight int,
	sampleCount int,
	didDrop bool,
) *ImmutableSampleWindow

NewImmutableSampleWindow will create a new ImmutableSampleWindow with defaults

func (*ImmutableSampleWindow) AddDroppedSample

func (s *ImmutableSampleWindow) AddDroppedSample(startTime int64, maxInFlight int) *ImmutableSampleWindow

AddDroppedSample will create a new immutable sample that was dropped.

func (*ImmutableSampleWindow) AddSample

func (s *ImmutableSampleWindow) AddSample(startTime int64, rtt int64, maxInFlight int) *ImmutableSampleWindow

AddSample will create a new immutable sample for which to use.

func (*ImmutableSampleWindow) AverageRTTNanoseconds

func (s *ImmutableSampleWindow) AverageRTTNanoseconds() int64

AverageRTTNanoseconds returns the average RTT in the sample window. Excludes timeouts and dropped rtt.

func (*ImmutableSampleWindow) CandidateRTTNanoseconds

func (s *ImmutableSampleWindow) CandidateRTTNanoseconds() int64

CandidateRTTNanoseconds returns the candidate RTT in the sample window. This is traditionally the minimum rtt.

func (*ImmutableSampleWindow) DidDrop

func (s *ImmutableSampleWindow) DidDrop() bool

DidDrop returns True if there was a timeout.

func (*ImmutableSampleWindow) MaxInFlight

func (s *ImmutableSampleWindow) MaxInFlight() int

MaxInFlight returns the maximum number of in-flight observed during the sample window.

func (*ImmutableSampleWindow) SampleCount

func (s *ImmutableSampleWindow) SampleCount() int

SampleCount is the number of observed RTTs in the sample window.

func (*ImmutableSampleWindow) StartTimeNanoseconds

func (s *ImmutableSampleWindow) StartTimeNanoseconds() int64

StartTimeNanoseconds returns the epoch start time in nanoseconds.

func (*ImmutableSampleWindow) String

func (s *ImmutableSampleWindow) String() string

type MinimumMeasurement

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

MinimumMeasurement implements a minimum value measurement

func (*MinimumMeasurement) Add

func (m *MinimumMeasurement) Add(sample float64) (float64, bool)

Add will compare the sample and save if it's the minimum value.

func (*MinimumMeasurement) Get

func (m *MinimumMeasurement) Get() float64

Get will return the current minimum value

func (*MinimumMeasurement) Reset

func (m *MinimumMeasurement) Reset()

Reset will reset the minimum value to 0.0

func (*MinimumMeasurement) String

func (m *MinimumMeasurement) String() string

func (*MinimumMeasurement) Update

func (m *MinimumMeasurement) Update(operation func(value float64) float64)

Update will update the value given an operation function

type SingleMeasurement

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

SingleMeasurement only keeps the latest value used.

func (*SingleMeasurement) Add

func (m *SingleMeasurement) Add(value float64) (float64, bool)

Add a single sample and update the internal state.

func (*SingleMeasurement) Get

func (m *SingleMeasurement) Get() float64

Get the current value.

func (*SingleMeasurement) Reset

func (m *SingleMeasurement) Reset()

Reset the internal state as if no samples were ever added.

func (*SingleMeasurement) String

func (m *SingleMeasurement) String() string

func (*SingleMeasurement) Update

func (m *SingleMeasurement) Update(operation func(value float64) float64)

Update will update the value given an operation function

Jump to

Keyboard shortcuts

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