From 4201ff03b599e184bc23d705c4f67ef6db46ed62 Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Fri, 17 Oct 2014 11:34:27 +0400 Subject: [PATCH] dashboard: separate build and non-build metrics in perf dashboard As per Ian request: >> Let's clearly separate the build numbers from the runtime numbers. >> The build numbers are interesting but there are many things that >> affect them. The runtime numbers are presumably stable. LGTM=adg R=adg CC=golang-codereviews, iant, rsc https://golang.org/cl/154440043 --- dashboard/app/build/build.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/dashboard/app/build/build.go b/dashboard/app/build/build.go index d8677a6fd40..0401cd2cd2b 100644 --- a/dashboard/app/build/build.go +++ b/dashboard/app/build/build.go @@ -654,6 +654,25 @@ func UpdatePerfConfig(c appengine.Context, r *http.Request, req *PerfRequest) (n return newBenchmark, nil } +type MetricList []string + +func (l MetricList) Len() int { + return len(l) +} + +func (l MetricList) Less(i, j int) bool { + bi := strings.HasPrefix(l[i], "build-") || strings.HasPrefix(l[i], "binary-") + bj := strings.HasPrefix(l[j], "build-") || strings.HasPrefix(l[j], "binary-") + if bi == bj { + return l[i] < l[j] + } + return !bi +} + +func (l MetricList) Swap(i, j int) { + l[i], l[j] = l[j], l[i] +} + func collectList(all []string, idx int, second string) (res []string) { m := make(map[string]bool) for _, str := range all { @@ -665,7 +684,7 @@ func collectList(all []string, idx int, second string) (res []string) { res = append(res, v) } } - sort.Strings(res) + sort.Sort(MetricList(res)) return res }