Commit 66643a14 authored by Russ Cox's avatar Russ Cox

benchstat: add input from benchfmt.Results

Change-Id: Idfc4d6b3cbd1e3c17182fe9565149e77ee1edb46
Reviewed-on: https://go-review.googlesource.com/35943Reviewed-by: default avatarQuentin Smith <quentin@golang.org>
parent c1e5ad7a
......@@ -10,6 +10,7 @@ import (
"strings"
"golang.org/x/perf/internal/stats"
"golang.org/x/perf/storage/benchfmt"
)
// A Collection is a collection of benchmark results.
......@@ -135,11 +136,24 @@ func (c *Collection) addMetrics(key Key) *Metrics {
return m
}
// AddConfig adds a set of benchmark results from a single configuration to the collection.
func (c *Collection) AddConfig(config string, data []byte) {
// AddFile adds the benchmark results in the formatted data
// to the named configuration.
func (c *Collection) AddFile(config string, data []byte) {
c.Configs = append(c.Configs, config)
key := Key{Config: config}
c.addText(key, string(data))
}
// AddResults adds the benchmark results to the named configuration.
func (c *Collection) AddResults(config string, results []*benchfmt.Result) {
c.Configs = append(c.Configs, config)
key := Key{Config: config}
for _, r := range results {
c.addText(key, r.Content)
}
}
func (c *Collection) addText(key Key, data string) {
for _, line := range strings.Split(string(data), "\n") {
f := strings.Fields(line)
if len(f) < 4 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment