runner

package
v0.0.0-...-f1f050a Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2015 License: MIT, MIT Imports: 7 Imported by: 0

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.

func (*Config) NewClient

func (cfg *Config) NewClient() (*client.Client, error)

newClient returns a pointer to an InfluxDB client for a `Config`'s `Address` field. If an error is encountered when creating a new client, the function panics.

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

type ResponseTime struct {
	Value int
	Time  time.Time
}

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

func (t *Timer) Elapsed() time.Duration

Elapsed returns the total elapsed time between the `start` and `end` fields on a timer.

func (*Timer) End

func (t *Timer) End() time.Time

End returns a Timers end field

func (*Timer) Start

func (t *Timer) Start() time.Time

Start returns a Timers start field

func (*Timer) StartTimer

func (t *Timer) StartTimer()

StartTimer sets a timers `start` field to the current time

func (*Timer) StopTimer

func (t *Timer) StopTimer()

StopTimer sets a timers `end` field to the current time

Jump to

Keyboard shortcuts

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