recipe

package
v0.0.0-...-cd31975 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QPSChangeFunc

type QPSChangeFunc func(w *WorkerState)

QPSChangeFunc is a helper type that describes the recipe function that runs every recipe interval.

type Recipe

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

Recipe encapsulates the information from a single recipe string. Note: Recipe objects are r/o once they are created. That allows multiple workers to hold a pointer to the same recipe.

func (*Recipe) Interval

func (r *Recipe) Interval() time.Duration

Interval returns the duration of the recipe interval.

type WorkerState

type WorkerState struct {
	OldQPS     float64 // the QPS we did last interval
	CurrentQPS float64 // the QPS we need to do this interval
	Recipe     *Recipe // the recipe this worker adheres to
	// contains filtered or unexported fields
}

WorkerState encapsulates the recipe state for each loadtest worker.

func ParseRecipes

func ParseRecipes() ([]*WorkerState, error)

ParseRecipes parses the --recipes flag and returns a slice of pointers to a WorkerState, one for each worker that you need to start. Note: Because Recipe objects are r/o, multiple workers might (probably will) end up with pointers to the same recipe in their worker states.

func (*WorkerState) IntervalExpired

func (w *WorkerState) IntervalExpired() bool

IntervalExpired checks if the recipe's interval or reset interval expired. If it has then the function returns true and it resets the worker state to the right values for the next interval: CurrentQPS will contain the QPS for the next interval, and OldQPS will contain the QPS of the interval that just finished. If no interval expired then the functional returns false.

Jump to

Keyboard shortcuts

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