helpers

package
v0.0.0-...-09dbe69 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TestImage is the image used in the test
	TestImage = "ubuntu:latest"
	// TestCommand is the command run in the container
	TestCommand = "/bin/bash"
)

Variables

This section is empty.

Functions

func Ftoas

func Ftoas(nums ...float64) []string

Ftoas converts float64 numbers to a slice of string

func Itoas

func Itoas(nums ...int) []string

Itoas converts int numbers to a slice of string

func LogEVar

func LogEVar(vars map[string]interface{})

LogEVar prints all the environemnt variables

func LogLabels

func LogLabels(labels ...string)

LogLabels prints the labels of the result table

func LogResult

func LogResult(latencies []int, variables ...string)

LogResult prints the item of the result table

func LogTitle

func LogTitle(title string)

LogTitle prints an empty line and the title of the benchmark

Types

type DockerHelper

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

DockerHelper provides the helper functions to simplify docker benchmark.

func NewDockerHelper

func NewDockerHelper(client *docker.Client) *DockerHelper

NewDockerHelper creates and returns a new DockerHelper

func (*DockerHelper) CreateAliveContainers

func (d *DockerHelper) CreateAliveContainers(num int) []string

CreateAliveContainers creates num of containers and also starts them, returns a slice of container ids

func (*DockerHelper) CreateContainers

func (d *DockerHelper) CreateContainers(num int) []string

CreateContainers creates num of containers, returns a slice of container ids

func (*DockerHelper) CreateDeadContainers

func (d *DockerHelper) CreateDeadContainers(num int) []string

CreateDeadContainers creates num of containers but not starts them, returns a slice of container ids

func (*DockerHelper) DoInspectContainerBenchmark

func (d *DockerHelper) DoInspectContainerBenchmark(interval, testPeriod time.Duration, containerIDs []string) []int

DoInspectContainerBenchmark does periodically InspectContainer with specific interval, returns latencies of all the calls in nanoseconds

func (*DockerHelper) DoListContainerBenchmark

func (d *DockerHelper) DoListContainerBenchmark(interval, testPeriod time.Duration, listAll bool) []int

DoListContainerBenchmark does periodically ListContainers with specific interval, returns latencies of all the calls in nanoseconds

func (*DockerHelper) DoParallelContainerStartBenchmark

func (d *DockerHelper) DoParallelContainerStartBenchmark(qps float64, testPeriod time.Duration, routineNumber int) []int

DoParallelContainerStartBenchmark starts routineNumber of goroutines and let them start containers, returns latencies of all the starting calls in nanoseconds. There is a global rate limit on starting calls per second.

func (*DockerHelper) DoParallelContainerStopBenchmark

func (d *DockerHelper) DoParallelContainerStopBenchmark(qps float64, routineNumber int) []int

DoParallelContainerStopBenchmark starts routineNumber of goroutines and let them stop containers, returns latencies of all the stopping calls in nanoseconds. There is a global rate limit on stopping calls per second.

func (*DockerHelper) DoParallelInspectContainerBenchmark

func (d *DockerHelper) DoParallelInspectContainerBenchmark(interval, testPeriod time.Duration, routineNumber int, containerIDs []string) []int

DoParallelInspectContainerBenchmark starts routineNumber of goroutines and let them do DoInspectContainerBenchmark, returns latencies of all the calls in nanoseconds

func (*DockerHelper) DoParallelListContainerBenchmark

func (d *DockerHelper) DoParallelListContainerBenchmark(interval, testPeriod time.Duration, routineNumber int, all bool) []int

DoParallelListContainerBenchmark starts routineNumber of goroutines and let them do DoListContainerBenchmark, returns latencies of all the calls in nanoseconds

func (*DockerHelper) GetContainerIDs

func (d *DockerHelper) GetContainerIDs() []string

GetContainerIDs returns all the container ids in the system, panics when error occurs

func (*DockerHelper) GetContainerNum

func (d *DockerHelper) GetContainerNum(all bool) int

GetContainerNum returns container number in the system, panics when error occurs

func (*DockerHelper) LogError

func (d *DockerHelper) LogError()

LogError logs all the docker operation errors to stderr and clear current errors TODO(random-liu): Print configuration and errors to stdout, and benchmark result to files

func (*DockerHelper) PullTestImage

func (d *DockerHelper) PullTestImage()

PullTestImage pulls the test image, panics when error occurs during pulling

func (*DockerHelper) RemoveContainers

func (d *DockerHelper) RemoveContainers(ids []string)

RemoveContainers removes all the containers in ids slice

func (*DockerHelper) StartContainers

func (d *DockerHelper) StartContainers(ids []string)

StartContainers starts all the containers in ids slice

func (*DockerHelper) StopContainers

func (d *DockerHelper) StopContainers(ids []string)

StopContainers stops all the containers in ids slice

type ErrorStats

type ErrorStats struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ErrorStats analyzes the errors occurred during the benchmark

Jump to

Keyboard shortcuts

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