pkg

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(spec *api.BenchmarkSpec, ctx *api.ExecutionContext)

Execute executes a benchmark and returns an object that provides access to collected stats.

func LoadSpec

func LoadSpec(path string) (*api.BenchmarkSpec, error)

LoadSpec loads benchmark specs from the specified file.

func NewCommandExecutor

func NewCommandExecutor(pipeStdout bool, pipeStderr bool) api.CommandExecutor

NewCommandExecutor creates a new command executor.

func NewStreamReportHandler added in v1.1.0

func NewStreamReportHandler(spec *api.BenchmarkSpec, ctx *api.ReportContext, handleFn HandleFn) api.ReportHandler

NewStreamReportHandler create stream report subscriber. Stream report handlers are designed to handle events in real time.

func NewSummary

func NewSummary(tracesByID map[api.ID][]api.Trace) api.Summary

NewSummary create a new TracerSummary with the specified data.

func NewSummaryReportHandler added in v1.1.0

func NewSummaryReportHandler(spec *api.BenchmarkSpec, ctx *api.ReportContext, writeReportFn api.WriteSummaryReportFn) api.ReportHandler

NewSummaryReportHandler create summary report subscriber Summary report handlers typically need to accumulate all the data in order to generate a report.

func NewTracer

func NewTracer(bufferSize int) api.Tracer

NewTracer creates a new tracer

func SaveSpec added in v1.3.0

func SaveSpec(spec *api.BenchmarkSpec, wc io.WriteCloser) (err error)

Types

type CmdRecordingExecutor

type CmdRecordingExecutor struct {
	RecordedCommandSeq []*RecordedExecutionParams
}

CmdRecordingExecutor ...

func (*CmdRecordingExecutor) Execute

func (ce *CmdRecordingExecutor) Execute(
	cmdSpec *api.CommandSpec,
	defaultWorkingDir string,
	env map[string]string,
) (exitError error)

Execute records execution parameters and stores them in order

type HandleFn added in v1.1.0

type HandleFn = func(api.Trace) error

HandleFn handles a trace event

type RecordedExecutionParams

type RecordedExecutionParams struct {
	Spec              *api.CommandSpec
	DefaultWorkingDir string
	Env               map[string]string
}

RecordedExecutionParams ...

type StreamSubscriber added in v1.1.0

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

StreamSubscriber FIXME

func NewStreamSubscriber added in v1.1.0

func NewStreamSubscriber(stream api.TraceStream, handleFn HandleFn) *StreamSubscriber

NewStreamSubscriber returns a new subscriber for the specified TraceStream. Does not subscribe immediately.

func (*StreamSubscriber) Subscribe added in v1.1.0

func (s *StreamSubscriber) Subscribe() Unsubscribe

Subscribe subscribes to the TraceStream and starts handling events. Returns an Unsubscribe handler that drains the underlaying channel and stops consuming events. This method can only be called once before Unsubscribe is called.

type TraceSink added in v1.1.0

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

TraceSink is a Trace accumulator capable of subscribing to a TraceStream and provide access to accumulated events

func NewTraceSink added in v1.1.0

func NewTraceSink(stream api.TraceStream) *TraceSink

NewTraceSink creates a new TraceSink for the specified stream.

func (*TraceSink) Subscribe added in v1.1.0

func (s *TraceSink) Subscribe() Unsubscribe

Subscribe subscribes to the trace events stream and returns an unsubscribe handler. Following that call, events start to accumulate.

func (*TraceSink) Summary added in v1.1.0

func (s *TraceSink) Summary() api.Summary

Summary returns an Summary object containing stats about accumulated events so far.

type Unsubscribe added in v1.1.0

type Unsubscribe = func()

Unsubscribe drains a TraceStream from buffered events and unsubscribes from it.

Jump to

Keyboard shortcuts

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