stress

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHistogramBuckets = []int64{1, 2, 5, 7, 10, 15, 25, 50, 75, 100, 250, 350, 500, 750, 1000, 5000}

Functions

This section is empty.

Types

type GenerateFn

type GenerateFn func(add GeneratorAddFn)

type Generator

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

Generator sets up a pool and a result collector

func NewGenerator

func NewGenerator(name string, parallelism int, opts ...GeneratorOption) *Generator

func (*Generator) Run

func (g *Generator) Run(fn WorkFn)

Run will start the worker goroutines and print out their progress every second. Upon completion (or on a SIGTERM), will also print a latency histogram

func (*Generator) Setup

func (g *Generator) Setup(fn GenerateFn)

type GeneratorAddFn

type GeneratorAddFn func(string)

type GeneratorOption

type GeneratorOption func(*Generator)

func WithSignalHandlersFor

func WithSignalHandlersFor(sigs ...os.Signal) GeneratorOption

type Histogram

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

func NewHistogram

func NewHistogram(buckets []int64) *Histogram

func (*Histogram) Add

func (h *Histogram) Add(v int64)

func (*Histogram) Clone

func (h *Histogram) Clone() *Histogram

func (*Histogram) String

func (h *Histogram) String() string

type Result

type Result struct {
	Error error
	Took  time.Duration
}

type ResultCollector

type ResultCollector struct {
	// Results is the channel workers should write their output to
	Results chan Result
	// contains filtered or unexported fields
}

func NewResultCollector

func NewResultCollector(workerResults chan Result) *ResultCollector

func (*ResultCollector) Collect

func (rc *ResultCollector) Collect()

func (*ResultCollector) Histogram

func (rc *ResultCollector) Histogram() *Histogram

func (*ResultCollector) Stats

func (rc *ResultCollector) Stats() *Stats

type Stats

type Stats struct {
	TotalCompleted   int64
	TotalErrors      int64
	CurrentCompleted int64
	CurrentInterval  time.Duration
}

func (*Stats) String

func (s *Stats) String() string

type WorkFn

type WorkFn func(input chan string, output chan Result)

type WorkerPool

type WorkerPool struct {
	Input  chan string
	Output chan Result
	// contains filtered or unexported fields
}

func NewWorkerPool

func NewWorkerPool(parallelism int) *WorkerPool

func (*WorkerPool) Done

func (p *WorkerPool) Done() chan struct{}

func (*WorkerPool) Start

func (p *WorkerPool) Start(workFn WorkFn)

Jump to

Keyboard shortcuts

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