v1.3.1 Latest Latest

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

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 7 Imported by: 2



Package bench provides benchmark output parsing capabilities.



This section is empty.


This section is empty.


This section is empty.


type Benchmark

type Benchmark struct {
	Name string
	Runs int

	NsPerOp float64
	Mem     Mem                // from '-benchmem'
	Custom  map[string]float64 `json:",omitempty"` //

Benchmark is an individual run. Note that all metrics in here must be represented as a float type, even if Go only emits integer values, so that in checks we can correctly evaluate divisions so that results come out as floats instead of being truncated to integers.

type LineReader added in v1.0.0

type LineReader interface {
	ReadLine() (line []byte, isPrefix bool, err error)

LineReader defines the API surface of bufio.Reader used by the parser

type Mem

type Mem struct {
	BytesPerOp  float64
	AllocsPerOp float64
	MBPerSec    float64

Mem is memory allocation information about a run

type Parser

type Parser struct {
	// contains filtered or unexported fields

Parser is gobenchdata's benchmark output parser

func NewParser

func NewParser(in *bufio.Reader) *Parser

NewParser instantiates a new benchmark parser that reads from the given buffer

func (*Parser) Read

func (p *Parser) Read() ([]Suite, error)

type Run

type Run struct {
	Version string `json:",omitempty"`
	Date    int64
	Tags    []string `json:",omitempty"`
	Suites  []Suite

Run denotes one run of gobenchdata, useful for grouping benchmark records

func (*Run) FindBenchmark added in v1.0.0

func (r *Run) FindBenchmark(pkg, bench string) (*Benchmark, bool)

FindBenchmark returns benchmark by package and bench name

type RunHistory

type RunHistory []Run

RunHistory is a sort.Interface that sorts the most recent run first

func (RunHistory) Latest added in v1.3.0

func (r RunHistory) Latest() Run

func (RunHistory) Len

func (r RunHistory) Len() int

func (RunHistory) Less

func (r RunHistory) Less(i, j int) bool

func (RunHistory) Runs

func (r RunHistory) Runs() []Run

Runs returns the underlyinng runs

func (RunHistory) Swap

func (r RunHistory) Swap(i, j int)

type Suite

type Suite struct {
	Goos       string
	Goarch     string
	Pkg        string
	Benchmarks []Benchmark

Suite is a suite of benchmark runs

Jump to

Keyboard shortcuts

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