dashboard: further improve graph view

1. Don't interpolate missing data points,
instead just use the previous value for missing points.
Interpolation hides significant line jumps,
making it look like the jump is a result of several small changes.
2. Add annotations for significant changes.

LGTM=adg
R=adg
CC=golang-codereviews, iant, rsc
https://golang.org/cl/154360046
This commit is contained in:
Dmitriy Vyukov 2014-10-17 12:17:50 +04:00
parent 165ed12db1
commit 2a277d9349
2 changed files with 15 additions and 22 deletions

View File

@ -133,6 +133,7 @@ func perfGraphHandler(w http.ResponseWriter, r *http.Request) {
var vals [][]float64 var vals [][]float64
var hints [][]string var hints [][]string
var annotations [][]string
var certainty [][]bool var certainty [][]bool
var headers []string var headers []string
commits2, err := GetCommits(c, startCommitNum, commitsToDisplay) commits2, err := GetCommits(c, startCommitNum, commitsToDisplay)
@ -157,6 +158,7 @@ func perfGraphHandler(w http.ResponseWriter, r *http.Request) {
} }
} }
if hasdata { if hasdata {
noise := pc.NoiseLevel(builder, benchProcs, metric)
descBuilder := "/" + builder descBuilder := "/" + builder
descBenchmark := "/" + benchProcs descBenchmark := "/" + benchProcs
descMetric := "/" + metric descMetric := "/" + metric
@ -171,31 +173,19 @@ func perfGraphHandler(w http.ResponseWriter, r *http.Request) {
} }
desc := fmt.Sprintf("%v%v%v", descBuilder, descBenchmark, descMetric)[1:] desc := fmt.Sprintf("%v%v%v", descBuilder, descBenchmark, descMetric)[1:]
hh := make([]string, commitsToDisplay) hh := make([]string, commitsToDisplay)
ann := make([]string, commitsToDisplay)
valf := make([]float64, commitsToDisplay) valf := make([]float64, commitsToDisplay)
cert := make([]bool, commitsToDisplay) cert := make([]bool, commitsToDisplay)
firstval := uint64(0) firstval := uint64(0)
lastval := uint64(0) lastval := uint64(0)
lastval0 := uint64(0)
for i, v := range vv { for i, v := range vv {
cert[i] = true cert[i] = true
if v == 0 { if v == 0 {
if lastval == 0 { if lastval == 0 {
continue continue
} }
nextval := uint64(0)
nextidx := 0
for i2, v2 := range vv[i+1:] {
if v2 != 0 {
nextval = v2
nextidx = i + i2 + 1
break
}
}
if nextval == 0 {
continue
}
cert[i] = false cert[i] = false
v = lastval + uint64(int64(nextval-lastval)/int64(nextidx-i+1)) v = lastval
} }
if firstval == 0 { if firstval == 0 {
firstval = v firstval = v
@ -203,21 +193,22 @@ func perfGraphHandler(w http.ResponseWriter, r *http.Request) {
valf[i] = float64(v) / float64(firstval) valf[i] = float64(v) / float64(firstval)
if cert[i] { if cert[i] {
d := "" d := ""
if lastval0 != 0 { if lastval != 0 {
d = fmt.Sprintf(" (%.02f%%)", perfDiff(lastval0, v)) diff := perfDiff(lastval, v)
d = fmt.Sprintf(" (%+.02f%%)", diff)
if !isNoise(diff, noise) {
ann[i] = fmt.Sprintf("%+.02f%%", diff)
}
} }
hh[i] = fmt.Sprintf("%v%v", v, d) hh[i] = fmt.Sprintf("%v%v", v, d)
} else { } else {
hh[i] = "NO DATA" hh[i] = "NO DATA"
} }
lastval = v lastval = v
if cert[i] {
lastval0 = v
}
} }
vals = append(vals, valf) vals = append(vals, valf)
hints = append(hints, hh) hints = append(hints, hh)
annotations = append(annotations, ann)
certainty = append(certainty, cert) certainty = append(certainty, cert)
headers = append(headers, desc) headers = append(headers, desc)
} }
@ -237,7 +228,7 @@ func perfGraphHandler(w http.ResponseWriter, r *http.Request) {
c := perfGraphCommit{Id: idx, Name: fmt.Sprintf("%v (%v)", com.Desc, com.Time.Format("Jan 2, 2006 1:04"))} c := perfGraphCommit{Id: idx, Name: fmt.Sprintf("%v (%v)", com.Desc, com.Time.Format("Jan 2, 2006 1:04"))}
idx++ idx++
for j := range vals { for j := range vals {
c.Vals = append(c.Vals, perfGraphValue{float64(vals[j][i]), certainty[j][i], hints[j][i]}) c.Vals = append(c.Vals, perfGraphValue{float64(vals[j][i]), certainty[j][i], hints[j][i], annotations[j][i]})
} }
commits = append(commits, c) commits = append(commits, c)
} }
@ -275,4 +266,5 @@ type perfGraphValue struct {
Val float64 Val float64
Certainty bool Certainty bool
Hint string Hint string
Ann string
} }

View File

@ -20,13 +20,14 @@
data.addColumn({type: 'number', label: '{{.}}'}); data.addColumn({type: 'number', label: '{{.}}'});
data.addColumn({type: 'boolean', role: 'certainty'}); data.addColumn({type: 'boolean', role: 'certainty'});
data.addColumn({type: 'string', role: 'tooltip'}); data.addColumn({type: 'string', role: 'tooltip'});
data.addColumn({type: 'string', role: 'annotation'});
{{end}} {{end}}
data.addRows([ data.addRows([
{{range $.Commits}} {{range $.Commits}}
[ {{.Id}}, 1, "{{.Name}}", [ {{.Id}}, 1, "{{.Name}}",
{{range .Vals}} {{range .Vals}}
{{if .Val}} {{if .Val}}
{{.Val}}, {{.Certainty}}, '{{.Hint}}', {{.Val}}, {{.Certainty}}, '{{.Hint}}', '{{.Ann}}',
{{else}} {{else}}
,,, ,,,
{{end}} {{end}}