benchmark

package
v0.0.0-...-163ab7f Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2017 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitCodeOK = 0

	// Specific error codes. begin 10-
	ExitCodeError = 10 + iota
	ExitCodeParseError
	ExitCodeInvalidArgsError
)

Exit codes. used only in Run()

Variables

View Source
var (
	// failed create session errors
	ErrNotFoundSession = errors.New("not found session")
	ErrFailedReadFile  = errors.New("failed to read file")
	ErrFailedParseJson = errors.New("failed to parse json")
)
View Source
var (
	// ErrParseFailed is failed to cli args parse
	ErrParseFailed = errors.New("failed to parse args")
)

Functions

func PrintDebugf

func PrintDebugf(format string, args ...interface{})

PrintDebugf behaves like log.Printf only in the debug env

Types

type BootstrapTask

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

BootstrapTask checks initial content consistency

func (*BootstrapTask) FinishHook

func (t *BootstrapTask) FinishHook(r Result) Result

func (*BootstrapTask) Task

func (t *BootstrapTask) Task(ctx Ctx, d *Driver) *Driver

type CLI

type CLI struct {
	OutStream io.Writer
	ErrStream io.Writer
}

CLI is the command line interface object

func (*CLI) Run

func (c *CLI) Run(args []string) int

Run invokes the CLI with the given arguments

type Checker

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

Checker is check benchmark response

type Ctx

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

Ctx is environment settings in each Worker

type Driver

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

type Helper

type Helper struct{}

type InitTask

type InitTask struct{}

InitTask is initialize

func (*InitTask) FinishHook

func (t *InitTask) FinishHook(r Result) Result

func (*InitTask) Task

func (t *InitTask) Task(ctx Ctx, d *Driver) *Driver

type LoadCheckerTask

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

Make load and check request. NOT SUPPORT CONCURRENCY

func (*LoadCheckerTask) FinishHook

func (t *LoadCheckerTask) FinishHook(r Result) Result

func (*LoadCheckerTask) Task

func (t *LoadCheckerTask) Task(ctx Ctx, d *Driver) *Driver

type LoadTask

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

Make load request. support concurrency

func (*LoadTask) FinishHook

func (t *LoadTask) FinishHook(r Result) Result

func (*LoadTask) Task

func (t *LoadTask) Task(ctx Ctx, d *Driver) *Driver

type Master

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

Master is manages the benchmark

func NewMaster

func NewMaster(host string, port int, file string, agent string) (*Master, error)

create Master and benchmark context

type ResponseCounter

type ResponseCounter struct {
	Success     int `json:"success"`      // 2xx
	Redirect    int `json:"redirect"`     // 3xx
	ClientError int `json:"client_error"` // 4xx
	ServerError int `json:"server_error"` // 5xx
	Exception   int `json:"exception"`    // failed request(for example, timeout)
	// contains filtered or unexported fields
}

ResponseCounter holds results for each benchmark

type Result

type Result struct {
	Valid        bool             `json:"valid"`
	RequestCount int              `json:"request_count"`
	ElapsedTime  int64            `json:"elapsed_time"`
	Response     *ResponseCounter `json:"response"`
	Violations   []*Violation     `json:"violations"`
	// contains filtered or unexported fields
}

Result is save benchmark results

func (*Result) Fail

func (r *Result) Fail()

func (*Result) Merge

func (r *Result) Merge(dst Result) *Result

type Session

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

Session is save cookies

type Task

type Task interface {
	Task(ctx Ctx, driver *Driver) *Driver
	FinishHook(result Result) Result
}

Task implement for each type of benchmark

type UserSchema

type UserSchema struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

type UserSchemas

type UserSchemas struct {
	Parameters []UserSchema
}

UserSchema represents the user column userd in the request

type Violation

type Violation struct {
	RequestName string `json:"request_type"`
	Cause       string `json:"description"`
	Count       int    `json:"num"`
}

Violation is save failed requests with cause

func (*Violation) String

func (v *Violation) String() string

type WorkOrder

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

func IsuconWorkOrder

func IsuconWorkOrder() []*WorkOrder

Specific workers

type Worker

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

Worker is send requests

func NewWorker

func NewWorker(ctx Ctx, time time.Duration, tasks []Task) *Worker

func (*Worker) String

func (w *Worker) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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