analysis: show wrapped query in place of result index Change-Id: I127a31864e96691bca504e81662a2992d5ee9f58 Reviewed-on: https://go-review.googlesource.com/36011 Reviewed-by: Russ Cox <rsc@golang.org>
diff --git a/analysis/app/compare.go b/analysis/app/compare.go index 0f22147..0ed01bd 100644 --- a/analysis/app/compare.go +++ b/analysis/app/compare.go
@@ -22,6 +22,8 @@ // A resultGroup holds a list of results and tracks the distinct labels found in that list. type resultGroup struct { + // The (partial) query string that resulted in this group. + Q string // Raw list of results. results []*benchfmt.Result // LabelValues is the count of results found with each distinct (key, value) pair found in labels. @@ -52,13 +54,13 @@ } // splitOn returns a new set of groups sharing a common value for key. -func (g *resultGroup) splitOn(key string) ([]string, []*resultGroup) { +func (g *resultGroup) splitOn(key string) []*resultGroup { groups := make(map[string]*resultGroup) var values []string for _, res := range g.results { value := res.Labels[key] if groups[value] == nil { - groups[value] = &resultGroup{} + groups[value] = &resultGroup{Q: key + ":" + value} values = append(values, value) } groups[value].add(res) @@ -69,7 +71,7 @@ for _, value := range values { out = append(out, groups[value]) } - return values, out + return out } // valueSet is a set of values and the number of results with each value. @@ -229,7 +231,7 @@ var found int for _, qPart := range queries { keys := queryKeys(qPart) - group := &resultGroup{} + group := &resultGroup{Q: qPart} if prefix != "" { qPart = prefix + " " + qPart } @@ -264,21 +266,15 @@ group := groups[0] // Matching a single upload with multiple files -> split by file if len(group.LabelValues["upload"]) == 1 && len(group.LabelValues["upload-part"]) > 1 { - var values []string - values, groups = group.splitOn("upload-part") - q := make([]string, len(values)) - for i, v := range values { - q[i] = "upload-part:" + v - } - queries = q + groups = group.splitOn("upload-part") } } var buf bytes.Buffer // Compute benchstat c := new(benchstat.Collection) - for i, g := range groups { - c.AddResults(queries[i], g.results) + for _, g := range groups { + c.AddResults(g.Q, g.results) } benchstat.FormatHTML(&buf, c.Tables())
diff --git a/analysis/appengine/template/compare.html b/analysis/appengine/template/compare.html index ec24663..afe1cea 100644 --- a/analysis/appengine/template/compare.html +++ b/analysis/appengine/template/compare.html
@@ -53,13 +53,20 @@ #labels .diff { padding-bottom: 1em; } -#labels .diff table td { +#labels .diff table td, #labels .diff .query { max-width: 20em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.benchstat tr.configs th { + max-width: 0; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + .benchstat { border-collapse: collapse; } .benchstat th:nth-child(1) { text-align: left; } .benchstat tbody td:nth-child(1n+2):not(.note) { text-align: right; padding: 0em 1em; } @@ -108,7 +115,7 @@ <th class="label">{{$label}}</th> <td> {{range $index, $group := $.Groups}} - Query {{$index}}: + <div class="query">{{$group.Q}}:</div> <table> {{with index $group.LabelValues $label}} {{range .TopN 4}}