runner

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MeasurementQuery

func MeasurementQuery(cfg *Config, timestamp chan time.Time, results chan QueryResults)

func NewSeries

func NewSeries(m string, p int, sc int) series

NewSeries takes a measurement, and point count, and a series count and returns a series

func Run

func Run(cfg *Config, done chan struct{}, ts chan time.Time) (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`

func SeriesQuery

func SeriesQuery(cfg *Config, done chan struct{}, results chan QueryResults)

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 {
	Write             write            `toml:"write"`
	Series            []series         `toml:"series"`
	MeasurementQuery  measurementQuery `toml:"measurement_query"`
	SeriesQuery       seriesQuery      `toml:"series_query"`
	ChannelBufferSize int              `toml:"channel_buffer_size"`
	SSL               bool             `toml:"ssl"`
}

Config is a struct that is passed into the `Run()` function.

func DecodeFile

func DecodeFile(s string) (*Config, error)

DecodeFile takes a file path for a toml config file and returns a pointer to a Config Struct.

func NewConfig

func NewConfig() *Config

NewConfig returns a pointer to a config with some default parameters set

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

Measurements holds all measurement results of the stress test

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 QueryResults

type QueryResults struct {
	TotalQueries  int
	ResponseTimes ResponseTimes
}

QueryResults holds the total number of executed queries and the response time for each query

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

ResponseTimes is a slice of response times

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