internal

package
v0.0.0-...-48a6f59 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NominalLineName

func NominalLineName(values OrderedStringStringMap, singleKey bool) string

NominalLineName returns how we should render this BenchmarkGroup's name in the UI. If they are all a single key then we just return the first value. Otherwise, return [key1=value1,key2=value2,...]

Types

type BenchmarkGroup

type BenchmarkGroup struct {
	// Values are the common key/value pairs that make up this benchmark group
	Values OrderedStringStringMap
	// Results are a list of benchmark results for this group
	Results BenchmarkList
}

BenchmarkGroup contains a set of parsed benchmark results for a group of values. All benchmarks will have the key/value pairs represented in Values

func (*BenchmarkGroup) String

func (b *BenchmarkGroup) String() string

type BenchmarkGroupList

type BenchmarkGroupList []*BenchmarkGroup

func (BenchmarkGroupList) AllSingleKey

func (b BenchmarkGroupList) AllSingleKey() bool

AllSingleKey returns true if all the benchmarks in this group are of a single value. This can help us render [name=bob] as just bob in the UI

func (BenchmarkGroupList) Normalize

func (b BenchmarkGroupList) Normalize()

Normalize removes all values that are the same in each BenchmarkGroup. For example, if all benchmarks have the value os=darwin, then we remove os=darwin from the BenchmarkGroup's Values map.

func (BenchmarkGroupList) String

func (b BenchmarkGroupList) String() string

type BenchmarkList

type BenchmarkList []benchparse.BenchmarkResult

BenchmarkList is a list of benchmarks

func (BenchmarkList) UniqueValuesForKey

func (b BenchmarkList) UniqueValuesForKey(key string) OrderedStringSet

UniqueValuesForKey returns all common value properties of each benchmark in this list for a key.

func (BenchmarkList) ValuesByX

func (b BenchmarkList) ValuesByX(xDim string, unit string, allValues OrderedStringSet) [][]float64

ValuesByX returns all values in this group for a given x, ordered by all possible x values. For example, if xDim='name', then allValues will contain all the values for xDim='name' and in the order we want to render them. So if there are two names, Jack and John, then allValues=[Jack,John]. Unit is the benchmark value's unit that we search for and return (unit is the Y dimension drawn). If a benchmark group has no values for, then an empty array is returned for that index. In other words, len(return_value) == len(alLValues)

type BenchmarkReader

type BenchmarkReader struct {
}

BenchmarkReader reads a benchmark run from an io stream.

func (*BenchmarkReader) ReadBenchmarks

func (a *BenchmarkReader) ReadBenchmarks(in io.Reader) (*benchparse.Run, error)

ReadBenchmarks returns the correct run from this reader.

type Filter

type Filter struct {
}

Filter understands how to filter a benchmark result set

func (*Filter) FilterBenchmarks

func (f *Filter) FilterBenchmarks(in []benchparse.BenchmarkResult, filters []FilterPair, unit string) BenchmarkList

FilterBenchmarks only returns benchmarks that contain this unit and belong to the filter pairs.

type FilterPair

type FilterPair struct {
	Key   string
	Value string
}

FilterPair controls how to filter. It means filter only key=value. If value is empty, then filters for existence.

func ToFilterPairs

func ToFilterPairs(s string) []FilterPair

ToFilterPairs converts a string of benchmark format to a list of filter pairs. For example, BenchmarkBob/name=john would become [{Key: BenchmarkBob}, {Key: name, Value: bob}]

type Grouper

type Grouper struct {
}

Grouper understands how to combine benchmarks into groups of common key/value pairs

func (*Grouper) GroupBenchmarks

func (g *Grouper) GroupBenchmarks(in BenchmarkList, groups OrderedStringSet) BenchmarkGroupList

GroupBenchmarks will return for each returned BenchmarkGroup will aggregate Results by unique groups Key/Value pairs

type Logger

type Logger struct {
	Verbosity int
	Logger    *log.Logger
}

Logger helps log output for benchdraw

func (*Logger) Log

func (l *Logger) Log(verbosity int, msg string, fmtArgs ...interface{})

Log a message if verbosity <= Logger.Verbosity. Uses Printf format.

type OrderedStringSet

type OrderedStringSet struct {
	Items map[string]struct{}
	Order []string
}

OrderedStringSet is a set of strings that remembers the order they are inserted in

func (*OrderedStringSet) Add

func (s *OrderedStringSet) Add(k string)

Add a value to the set and append the key to Order. Does nothing if the set already contains the key.

func (*OrderedStringSet) Contains

func (s *OrderedStringSet) Contains(k string) bool

Contains returns true if the set contains a string

type OrderedStringStringMap

type OrderedStringStringMap struct {
	Values map[string]string
	Order  []string
}

OrderedStringStringMap is a map that maintins insert order

func (*OrderedStringStringMap) Contains

func (h *OrderedStringStringMap) Contains(k string, v string) bool

Contains returns true if this value == this key and this key exists. Useful if v can be empty

func (*OrderedStringStringMap) Hash

func (h *OrderedStringStringMap) Hash() string

Hash the contents of Values, ignoring order

func (*OrderedStringStringMap) Insert

func (h *OrderedStringStringMap) Insert(k string, v string)

Insert a value into the map

func (*OrderedStringStringMap) Remove

func (h *OrderedStringStringMap) Remove(k string)

Remove a value from the map

func (*OrderedStringStringMap) String

func (h *OrderedStringStringMap) String() string

String pretty prints Values

type PlotLine

type PlotLine struct {
	Name   string
	Values [][]float64
}

PlotLine is a line to plot. It has a name (used in the legend) and values for each x index. It assumes integer indexes.

type PlotType

type PlotType int
const (

	// PlotTypeBar is a bar graph
	PlotTypeBar PlotType
	// PlotTypeLine is a line graph
	PlotTypeLine
)

func ToPlotType

func ToPlotType(s string) (PlotType, error)

ToPlotType converts a string name to a known plot type

type Plotter

type Plotter struct {
}

Plotter knows how to draw a picture to a writer

func (*Plotter) Plot

func (l *Plotter) Plot(log Logger, out io.Writer, imgFormat string, pt PlotType, title string, x string, y string, lines []PlotLine, uniqueKeys OrderedStringSet) error

Plot will write to out this plot.

Jump to

Keyboard shortcuts

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