Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstWorkerTicker ¶
ConstWorkerTicker is the const worker
func (*ConstWorkerTicker) Ticker ¶
func (c *ConstWorkerTicker) Ticker() <-chan TickValue
Ticker returns the ticker channer
type ConstantPacer ¶
type ConstantPacer struct { Freq uint64 // Frequency of hits per second Max uint64 // Optional maximum allowed hits }
A ConstantPacer defines a constant rate of hits for the target.
func (*ConstantPacer) Pace ¶
Pace determines the length of time to sleep until the next hit is sent.
func (*ConstantPacer) Rate ¶
func (cp *ConstantPacer) Rate(elapsed time.Duration) float64
Rate returns a ConstantPacer's instantaneous hit rate (i.e. requests per second) at the given elapsed duration of an attack. Since it's constant, the return value is independent of the given elapsed duration.
func (*ConstantPacer) String ¶
func (cp *ConstantPacer) String() string
String returns a pretty-printed description of the ConstantPacer's behaviour:
ConstantPacer{Freq: 1} => Constant{1 hits/1s}
type LineWorkerTicker ¶
type LineWorkerTicker struct { C chan TickValue Start uint Slope int Stop uint LoadDuration time.Duration // contains filtered or unexported fields }
LineWorkerTicker is the worker ticker that implements line adjustments to concurrency
func (*LineWorkerTicker) Ticker ¶
func (c *LineWorkerTicker) Ticker() <-chan TickValue
Ticker returns the ticker channer
type LinearPacer ¶
type LinearPacer struct { Start ConstantPacer Slope int64 Stop ConstantPacer LoadDuration time.Duration Max uint64 // contains filtered or unexported fields }
LinearPacer paces an attack by starting at a given request rate and increasing linearly with the given slope.
func (*LinearPacer) Rate ¶
func (p *LinearPacer) Rate(elapsed time.Duration) float64
Rate returns a LinearPacer's instantaneous hit rate (i.e. requests per second) at the given elapsed duration of an attack.
func (*LinearPacer) String ¶
func (p *LinearPacer) String() string
String returns a pretty-printed description of the LinearPacer's behaviour:
LinearPacer{Slope: 1} => Linear{1 hits/1s}
type Pacer ¶
type Pacer interface { // Pace returns the duration the attacker should wait until // making next hit, given an already elapsed duration and // completed hits. If the second return value is true, an attacker // should stop sending hits. Pace(elapsed time.Duration, hits uint64) (wait time.Duration, stop bool) // Rate returns a Pacer's instantaneous hit rate (per seconds) // at the given elapsed duration of an attack. Rate(elapsed time.Duration) float64 }
A Pacer defines the control interface to control the rate of hit.
type StepPacer ¶
type StepPacer struct { Start ConstantPacer Step int64 StepDuration time.Duration Stop ConstantPacer LoadDuration time.Duration Max uint64 // contains filtered or unexported fields }
StepPacer paces an attack by starting at a given request rate and increasing with steps at a given time interval and duration.
type StepWorkerTicker ¶
type StepWorkerTicker struct { C chan TickValue Start uint Step int StepDuration time.Duration Stop uint LoadDuration time.Duration }
StepWorkerTicker is the worker ticker that implements step adjustments to concurrency
func (*StepWorkerTicker) Ticker ¶
func (c *StepWorkerTicker) Ticker() <-chan TickValue
Ticker returns the ticker channer
type WorkerTicker ¶
type WorkerTicker interface { Ticker() <-chan TickValue Run() Finish() }
WorkerTicker is the interface for worker ticker which controls worker parallelism