perf: golang.org/x/perf/storage/benchfmt Index | Files

package benchfmt

import "golang.org/x/perf/storage/benchfmt"

Package benchfmt provides readers and writers for the Go benchmark format.

The format is documented at https://golang.org/design/14313-benchmark-format

Index

Package Files

benchfmt.go

type Labels Uses

type Labels map[string]string

Labels is a set of key-value strings.

func (Labels) Copy Uses

func (l Labels) Copy() Labels

Copy returns a new copy of the labels map, to protect against future modifications to labels.

func (Labels) Equal Uses

func (l Labels) Equal(b Labels) bool

Equal reports whether l and b have the same keys and values.

func (Labels) Keys Uses

func (l Labels) Keys() []string

Keys returns a sorted list of the keys in l.

func (Labels) String Uses

func (l Labels) String() string

String returns the labels formatted as a comma-separated list enclosed in braces.

type Printer Uses

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

A Printer prints a sequence of benchmark results.

func NewPrinter Uses

func NewPrinter(w io.Writer) *Printer

NewPrinter constructs a BenchmarkPrinter writing to w.

func (*Printer) Print Uses

func (p *Printer) Print(r *Result) error

Print writes the lines necessary to recreate r.

type Reader Uses

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

Reader reads benchmark results from an io.Reader. Use Next to advance through the results.

br := benchfmt.NewReader(r)
for br.Next() {
  res := br.Result()
  ...
}
err = br.Err() // get any error encountered during iteration
...

func NewReader Uses

func NewReader(r io.Reader) *Reader

NewReader creates a BenchmarkReader that reads from r.

func (*Reader) AddLabels Uses

func (r *Reader) AddLabels(labels Labels)

AddLabels adds additional labels as if they had been read from the header of a file. It must be called before the first call to r.Next.

func (*Reader) Err Uses

func (r *Reader) Err() error

Err returns the error state of the reader.

func (*Reader) Next Uses

func (r *Reader) Next() bool

Next returns the next benchmark result from the file. If there are no further results, it returns nil, io.EOF.

func (*Reader) Result Uses

func (r *Reader) Result() *Result

Result returns the most recent result generated by a call to Next.

type Result Uses

type Result struct {
    // Labels is the set of persistent labels that apply to the result.
    // Labels must not be modified.
    Labels Labels
    // NameLabels is the set of ephemeral labels that were parsed
    // from the benchmark name/line.
    // NameLabels must not be modified.
    NameLabels Labels
    // LineNum is the line number on which the result was found
    LineNum int
    // Content is the verbatim input line of the benchmark file, beginning with the string "Benchmark".
    Content string
}

Result represents a single line from a benchmark file. All information about that line is self-contained in the Result. A Result is immutable once created.

func (*Result) SameLabels Uses

func (r *Result) SameLabels(b *Result) bool

SameLabels reports whether r and b have the same labels.

Package benchfmt imports 8 packages (graph) and is imported by 8 packages. Updated 2017-07-17. Refresh now. Tools for package owners.