run

package
v0.0.0-...-cb472e6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Concurrent int
View Source
var SustainSeconds float64
View Source
var TotalRequest int64

if TotalRequest is set,it has higher priority than SustainSecond

Functions

func SetBlue

func SetBlue(v interface{}) string

func SetGreen

func SetGreen(v interface{}) string

func SetRed

func SetRed(v interface{}) string

func SetYellow

func SetYellow(v interface{}) string

Types

type Limiter

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

func NewStreamLimiter

func NewStreamLimiter(concurrent int) *Limiter

func (*Limiter) Execute

func (sl *Limiter) Execute(ch chan<- *Status, f func() error)

Warning: please use this func carefully. for instance, when you use this func in a for loop, please be sure that the f variable is concurrent secure.

func (*Limiter) IsEmpty

func (sl *Limiter) IsEmpty() bool

func (*Limiter) Release

func (sl *Limiter) Release()

func (*Limiter) Require

func (sl *Limiter) Require()

type Metrics

type Metrics struct {
	SustainSeconds float64
	Concurrent     int
	QPS            float64
	// in millisecond
	MaxDuration       float64
	MinDuration       float64
	MedianDuration    float64
	AverageDuration   float64
	Percent85Duration float64
	Percent95Duration float64

	TotalRequest    int64
	SucceedRequest  int64
	FailedRequest   int64
	OnTheFlyRequest int64
}

func FireLoadTest

func FireLoadTest(f func() error) Metrics

func (*Metrics) Format

func (m *Metrics) Format() string

type Statistic

type Statistic struct {
	// the total seconds of this statistic
	SustainSecond float64
	// the count of goroutines to run
	Concurrent int
	// total request that has been send.
	TotalRequest int64
	// success request number
	TotalSucceed int64
	// failed request number
	TotalFailed int64

	// in millisecond
	// only record success metrics
	TotalCostDuration float64
	Values            []float64
	// Request cost duration
	MinCostDuration float64
	MaxCostDuration float64
}

func (*Statistic) CalculateMetrics

func (s *Statistic) CalculateMetrics() Metrics

func (*Statistic) CollectStatus

func (s *Statistic) CollectStatus(status *Status)

func (*Statistic) IncreaseFailed

func (s *Statistic) IncreaseFailed()

func (*Statistic) IncreaseRequest

func (s *Statistic) IncreaseRequest()

func (*Statistic) IncreaseSuccess

func (s *Statistic) IncreaseSuccess()

func (*Statistic) UpdateCostDuration

func (s *Statistic) UpdateCostDuration(t time.Duration)

only update success request data

type Status

type Status struct {
	CostDuration time.Duration
	Error        error
}

Jump to

Keyboard shortcuts

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