Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(cfg *Config) (totalPoints int, failedRequests int, responseTimes ResponseTimes, timer *Timer)
Run runs the stress test that is specified by a `Config`. It returns the total number of points that were during the test, an slice of all of the stress tests response times, and the times that the test started at and ended as a `Timer`
Types ¶
type ConcurrencyLimiter ¶
type ConcurrencyLimiter struct {
// contains filtered or unexported fields
}
ConcurrencyLimiter is a go routine safe struct that can be used to ensure that no more than a specifid max number of goroutines are executing.
func NewConcurrencyLimiter ¶
func NewConcurrencyLimiter(max int) *ConcurrencyLimiter
NewConcurrencyLimiter returns a configured limiter that will ensure that calls to Increment will block if the max is hit.
func (*ConcurrencyLimiter) Decrement ¶
func (c *ConcurrencyLimiter) Decrement()
Decrement will reduce the count of running goroutines by 1
func (*ConcurrencyLimiter) Increment ¶
func (c *ConcurrencyLimiter) Increment()
Increment will increase the count of running goroutines by 1. if the number is currently at the max, the call to Increment will block until another goroutine decrements.
type Config ¶
type Config struct { BatchSize int Measurements Measurements SeriesCount int PointCount int Concurrency int BatchInterval time.Duration Database string Address string Precision string }
Config is a struct that is passed into the `Run()` function.
type Measurements ¶
type Measurements []string
func (*Measurements) Set ¶
func (ms *Measurements) Set(value string) error
Set implements the `Set` method for the flag.Value interface. Set splits a string of comma separated values into a `Measurement`.
func (*Measurements) String ¶
func (ms *Measurements) String() string
String returns a string and implements the `String` method for the flag.Value interface.
type ResponseTime ¶
ResponseTime is a struct that contains `Value` `Time` pairing.
func NewResponseTime ¶
func NewResponseTime(v int) ResponseTime
newResponseTime returns a new response time with value `v` and time `time.Now()`.
type ResponseTimes ¶
type ResponseTimes []ResponseTime
func (ResponseTimes) Len ¶
func (rs ResponseTimes) Len() int
Implements the `Len` method for the sort.Interface type
func (ResponseTimes) Less ¶
func (rs ResponseTimes) Less(i, j int) bool
Implements the `Less` method for the sort.Interface type
func (ResponseTimes) Swap ¶
func (rs ResponseTimes) Swap(i, j int)
Implements the `Swap` method for the sort.Interface type
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer is struct that can be used to track elaspsed time
func NewTimer ¶
func NewTimer() *Timer
NewTimer returns a pointer to a `Timer` struct where the timers `start` field has been set to `time.Now()`
func (*Timer) Elapsed ¶
Elapsed returns the total elapsed time between the `start` and `end` fields on a timer.
func (*Timer) StartTimer ¶
func (t *Timer) StartTimer()
StartTimer sets a timers `start` field to the current time