benchmark

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBenchmarks

func GetBenchmarks() map[string]Benchmark

func RegisterBenchmark

func RegisterBenchmark(benchmark Benchmark)

func RunMain

func RunMain()

Types

type BenchDirConfig

type BenchDirConfig interface {
	Get() (string, error)
}

BenchDirConfig controls the directory where the benchmark data will be generated.

type Benchmark

type Benchmark interface {
	// Name should return the name of the benchmark. It will also be used to match against cli args.
	Name() string

	// Setup sets up the benchmark state, this is not timed.
	Setup(ctx context.Context, benchmarkDir string) error

	// Run performs the actual benchmark, this is timed.
	Run(ctx context.Context) (*reporter.BenchmarkRun, error)

	// TearDown clear the benchmark state, this is not timed.
	TearDown(ctx context.Context) error
}

type FixedBenchDirConfig

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

FixedBenchDirConfig always returns a known path.

func NewFixedBenchDirConfig

func NewFixedBenchDirConfig(path string) *FixedBenchDirConfig

func (*FixedBenchDirConfig) Get

func (p *FixedBenchDirConfig) Get() (string, error)

type TmpBenchDirConfig

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

TmpBenchDirConfig returns a temporary path that is generated on first use.

func (*TmpBenchDirConfig) Get

func (t *TmpBenchDirConfig) Get() (string, error)

Jump to

Keyboard shortcuts

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