core

package
v0.0.0-...-fac17f9 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package core provide main components of go-perfsuite project

Index

Constants

View Source
const (
	STATE_USER_STOPPED = 0
	STATE_USER_RUNNING = 1
	STATE_USER_PAUSED  = 2
)
View Source
const DEFAULT_HTTP_PORT = 8000

Variables

This section is empty.

Functions

func IndexHandler

func IndexHandler(a *appContext, w http.ResponseWriter, r *http.Request) (int, error)

Types

type ControllerConfig

type ControllerConfig struct {
	HttpServerPort int
}

type ControllerInstance

type ControllerInstance struct {
	Config *ControllerConfig
}

func NewControllerInstance

func NewControllerInstance() *ControllerInstance

func (*ControllerInstance) StartHttpServer

func (c *ControllerInstance) StartHttpServer()

type Counter

type Counter struct {
	Start int64
	End   int64
}

type Injector

type Injector struct {
	Users []*Iuser

	Stat       *StatStack
	Repository map[string]interface{}
	// contains filtered or unexported fields
}

func NewInjector

func NewInjector() *Injector

func (*Injector) GetState

func (inj *Injector) GetState() map[int]int

func (*Injector) Initialize

func (inj *Injector) Initialize(scriptFile string)

func (*Injector) Run

func (inj *Injector) Run()

Run start an infinite loop for starting, stopping iusers

func (*Injector) SetRamp

func (inj *Injector) SetRamp(pRamp []int64)

func (*Injector) UpdateSpeed

func (inj *Injector) UpdateSpeed() bool

Starts new iusers if needed, according to ramp

type Iscenario

type Iscenario interface {
	InitOnce()
	Init()
	Run()
	Stop()
}

type Iuser

type Iuser struct {
	Uuid     string
	Scenario Iscenario
	NRuns    int
	Id       int
	Inj      *Injector
	Counters map[string]Counter
	// contains filtered or unexported fields
}

func NewIuser

func NewIuser(pInj *Injector) *Iuser

Create an IUser, with LUA runtime

func (*Iuser) DoInit

func (i *Iuser) DoInit()

func (*Iuser) DoInitOnce

func (i *Iuser) DoInitOnce()

func (*Iuser) DoRun

func (i *Iuser) DoRun()

func (*Iuser) DoStop

func (i *Iuser) DoStop()

func (*Iuser) LoadScenarioString

func (i *Iuser) LoadScenarioString(pScenario string)

* Entry points

func (*Iuser) TransactionStart

func (i *Iuser) TransactionStart(tName string)

func (*Iuser) TransactionStop

func (i *Iuser) TransactionStop(tName string, tStatus int)

type Stat

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

type StatStack

type StatStack struct {
	Addr string
	Db   string
	User string
	Pass string
	// contains filtered or unexported fields
}

func NewStatStack

func NewStatStack(pInj *Injector) *StatStack

NewStatStack returns instance of StatStack structure

func (*StatStack) DoRun

func (i *StatStack) DoRun()

DoRun is the main loop that will pop the stats from the buffer and send them to the selected backend

func (*StatStack) FlushInflux

func (i *StatStack) FlushInflux()

func (*StatStack) Push

func (i *StatStack) Push(pName string, pVal float64)

Push adds new statistic to the StatStack buffer The new statistic is the couple (name,value)

Jump to

Keyboard shortcuts

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