bench

package
Version: v0.0.0-...-50e663b Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInstancesSize   = 1
	DefaultTrialsSize      = 5
	DefaultForksSize       = 10
	DefaultIterationsSize  = 20
	DefaultInvocationsSize = 200
)

Variables

This section is empty.

Functions

func AllInvocations

func AllInvocations(ivs []Invocations) []float64

func MeanInvocations

func MeanInvocations(ivs []Invocations) []float64

Types

type ArraySizes

type ArraySizes struct {
	Instances   int
	Trials      int
	Forks       int
	Iterations  int
	Invocations int
}

type B

type B struct {
	Name           string
	FunctionParams FunctionParams
	PerfParams     *PerfParams
}

func New

func New(name string) *B

func (*B) Compare

func (b *B) Compare(other *B) int

Compare compares two Benchmarks lexically and returns -1 (this is smaller), 0 (they are equal), or 1 (other is smaller)

func (*B) Copy

func (b *B) Copy() *B

func (*B) Equals

func (b *B) Equals(other *B) bool

func (*B) String

func (b *B) String() string

type Chan

type Chan chan ExecutionValue

func FromCSV

func FromCSV(ctx context.Context, r io.Reader) (Chan, error)

func MergeChans

func MergeChans(cs ...Chan) Chan

func TransformChan

func TransformChan(transformer ExecutionTransformer, c Chan) Chan

type Execution

type Execution struct {
	Benchmark   *B
	InstanceIDs []string
	Instances   map[string]*Instance
	// contains filtered or unexported fields
}

func IdentityExecutionTransformerFunc

func IdentityExecutionTransformerFunc(e *Execution) *Execution

func NewExecution

func NewExecution(b *B) *Execution

func NewExecutionFromInvocationsFlat

func NewExecutionFromInvocationsFlat(ivf InvocationsFlat) *Execution

func NewExecutionWithDefaults

func NewExecutionWithDefaults(b *B, d ArraySizes) *Execution

func (*Execution) AddInvocations

func (e *Execution) AddInvocations(is InvocationsFlat) error

func (*Execution) Copy

func (e *Execution) Copy() *Execution

func (*Execution) ElementCount

func (e *Execution) ElementCount() int

func (*Execution) FlatSlice

func (e *Execution) FlatSlice(s InvocationSampler) []float64

func (*Execution) Merge

func (e *Execution) Merge(other *Execution) error

func (*Execution) Slice

func (e *Execution) Slice(s InvocationSampler) [][][][][]float64

type ExecutionSlice

type ExecutionSlice interface {
	Slice(InvocationSampler) [][][][][]float64
	FlatSlice(InvocationSampler) []float64
}

type ExecutionTransformer

type ExecutionTransformer interface {
	// contains filtered or unexported methods
}

type ExecutionTransformerFunc

type ExecutionTransformerFunc func(*Execution) *Execution

func ConstantFactorExecutionTransformerFunc

func ConstantFactorExecutionTransformerFunc(factor float64, roundingPrecision int) ExecutionTransformerFunc

type ExecutionType

type ExecutionType int
const (
	ExecNext ExecutionType = iota
	ExecError
	ExecStart
	ExecEnd
)

type ExecutionValue

type ExecutionValue struct {
	Type ExecutionType
	Exec *Execution
	Err  error
}

type Executions

type Executions []*Execution

func (Executions) Len

func (e Executions) Len() int

func (Executions) Less

func (e Executions) Less(i, j int) bool

func (Executions) Swap

func (e Executions) Swap(i, j int)

type Fork

type Fork struct {
	ID           int
	IterationIDs []int
	Iterations   map[int]*Iteration
}

func (*Fork) Merge

func (f *Fork) Merge(other *Fork) error

type FunctionParams

type FunctionParams []string

func (FunctionParams) String

func (fp FunctionParams) String() string

type Instance

type Instance struct {
	ID       string
	TrialIDs []int
	Trials   map[int]*Trial
}

func (*Instance) Merge

func (i *Instance) Merge(other *Instance) error

type InvocationSampler

type InvocationSampler func([]Invocations) []float64

func SampleInvocations

func SampleInvocations(samples int) InvocationSampler

type Invocations

type Invocations struct {
	Count int
	Value float64
}

type InvocationsFlat

type InvocationsFlat struct {
	Benchmark   *B
	Instance    string
	Trial       int
	Fork        int
	Iteration   int
	Invocations Invocations
}

type Iteration

type Iteration struct {
	ID          int
	Invocations []Invocations
}

func (*Iteration) Merge

func (i *Iteration) Merge(other *Iteration) error

type NamedExecutionTransformer

type NamedExecutionTransformer struct {
	ExecutionTransformer
	Name string
}

type PerfParams

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

func (*PerfParams) Add

func (pp *PerfParams) Add(param, value string)

func (*PerfParams) Copy

func (pp *PerfParams) Copy() *PerfParams

func (*PerfParams) Get

func (pp *PerfParams) Get() map[string]string

func (*PerfParams) Keys

func (pp *PerfParams) Keys() []string

func (*PerfParams) String

func (pp *PerfParams) String() string

type Trial

type Trial struct {
	ID      int
	ForkIDs []int
	Forks   map[int]*Fork
}

func (*Trial) Merge

func (t *Trial) Merge(other *Trial) error

Jump to

Keyboard shortcuts

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