Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BenchmarkSpec ¶
type BenchmarkSpec struct {
Scenarios []*ScenarioSpec `json:"scenarios" yaml:"scenarios" validate:"required,min=1,dive"`
Executions int `validate:"required,gte=1"`
Alternate bool `json:"alternate,omitempty" yaml:"alternate,omitempty"`
}
BenchmarkSpec benchmark specs top level structure
type CommandExecutor ¶
type CommandExecutor interface {
Execute(cmd *CommandSpec, defaultWorkingDir string, env map[string]string) error
}
CommandExecutor is an abstraction for commands executed as subprocesses.
type CommandSpec ¶
type CommandSpec struct {
WorkingDirectory string `json:"workingDir,omitempty" yaml:"workingDir,omitempty"`
Cmd []string `json:"cmd" yaml:"cmd" validate:"required"`
}
CommandSpec benchmark command execution specs
type ExecutionContext ¶
type ExecutionContext struct {
Executor CommandExecutor
Tracer Tracer
}
ExecutionContext provides access to benchmark global resources
func NewExecutionContext ¶
func NewExecutionContext(tracer Tracer, executor CommandExecutor) *ExecutionContext
NewExecutionContext creates a new ExecutionContext.
type Identifiable ¶
type Identifiable interface {
ID() ID
}
Identifiable an abstraction for identifiable objects
type ReportContext ¶ added in v0.0.8
ReportContext contextual information to propagate to report handlers
type ReportHandler ¶ added in v1.1.0
type ReportHandler interface {
Subscribe(TraceStream)
Finalize() error
}
ReportHandler an async handler
type ScenarioSpec ¶
type ScenarioSpec struct {
Name string `json:"name" yaml:"name" validate:"required"`
WorkingDirectory string `json:"workingDir,omitempty" yaml:"workingDir,omitempty"`
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
BeforeAll *CommandSpec `json:"beforeAll,omitempty" yaml:"beforeAll,omitempty"`
AfterAll *CommandSpec `json:"afterAll,omitempty" yaml:"afterAll,omitempty"`
BeforeEach *CommandSpec `json:"beforeEach,omitempty" yaml:"beforeEach,omitempty"`
AfterEach *CommandSpec `json:"afterEach,omitempty" yaml:"afterEach,omitempty"`
Command *CommandSpec `validate:"required,dive"`
}
ScenarioSpec benchmark scenario specs
type Stats ¶
type Stats interface {
Min() (float64, error)
Max() (float64, error)
Mean() (float64, error)
Median() (float64, error)
Percentile(percent float64) (float64, error)
StdDev() (float64, error)
ErrorRate() float64
Count() int
}
Stats provides access to statistics. Statistics are not necessarily cached and might be calculated on call.
type Tracer ¶
type Tracer interface {
Start(i Identifiable) End
Stream() TraceStream
}
Tracer a global tracing handler that accumulates trace data and provides access to it.
type WriteSummaryReportFn ¶ added in v1.1.0
type WriteSummaryReportFn = func(Summary, *BenchmarkSpec, *ReportContext) error
WriteSummaryReportFn a benchmark report handler