pacer

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pacer

type Pacer interface {
	// Pace returns the duration an Runner should wait until
	// hitting the next Target, given an already elapsed duration and
	// completed hits.
	Pace(elapsed time.Duration, hits uint64) (wait time.Duration)

	// Rate returns a Pacer's instantaneous hit rate (per seconds)
	// at the given elapsed duration of an execution.
	Rate(elapsed time.Duration) float64
}

A Pacer defines the rate of hits during an Attack.

func NewConstantPacer

func NewConstantPacer(rate Rate) Pacer

func NewLinearRampUpPacer

func NewLinearRampUpPacer(startRate Rate, targetRate Rate, rampUpDuration time.Duration) Pacer

NewLinearRampUpPacer creates a linear increase from the start to Target rate within the given RampUpDuration

type Rate

type Rate struct {
	Freq int           // Frequency (number of occurrences) per ...
	Per  time.Duration // Time unit, usually 1s
}

Jump to

Keyboard shortcuts

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