aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-testbed/stats.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2021-11-30 14:30:41 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2021-12-06 14:29:36 +0100
commit45bf1e232e9518f6666c051c242a4ef656a97228 (patch)
treeef77af18a08a6d4e8eade22466ebdcaad813814e /tools/syz-testbed/stats.go
parent9bc82119f890ecaa556935301dc721f90100d2dd (diff)
tools/syz-testbed: align table per particular rows
It turns out that we often want to see the data aligned on some specific property - e.g. align all checkouts by "exec total" and see how other parameters differ. Add a preliminary support of such a feature. On a row title click, pick the minimal value in the row and wind the history of each column back until the target row value is closest to the minimal one.
Diffstat (limited to 'tools/syz-testbed/stats.go')
-rw-r--r--tools/syz-testbed/stats.go33
1 files changed, 27 insertions, 6 deletions
diff --git a/tools/syz-testbed/stats.go b/tools/syz-testbed/stats.go
index 42ce9537b..20ad9bb30 100644
--- a/tools/syz-testbed/stats.go
+++ b/tools/syz-testbed/stats.go
@@ -182,26 +182,47 @@ func (group RunResultGroup) groupNthRecord(i int) map[string]*stats.Sample {
}
func (view StatView) StatsTable() (*Table, error) {
- commonLen := 0
+ return view.AlignedStatsTable("uptime")
+}
+
+func (view StatView) AlignedStatsTable(field string) (*Table, error) {
+ // We assume that the stats values are nonnegative.
+ var commonValue float64
for _, group := range view.Groups {
minLen := group.minResultLength()
if minLen == 0 {
continue
}
- if minLen < commonLen || commonLen == 0 {
- commonLen = minLen
+ sampleGroup := group.groupNthRecord(minLen - 1)
+ sample, ok := sampleGroup[field]
+ if !ok {
+ return nil, fmt.Errorf("field %v is not found", field)
+ }
+ currValue := sample.Median()
+ if currValue < commonValue || commonValue == 0 {
+ commonValue = currValue
}
}
- // Map: stats key x group name -> value.
table := NewTable("Property")
cells := make(map[string]map[string]string)
for _, group := range view.Groups {
table.AddColumn(group.Name)
- if group.minResultLength() == 0 {
+ minLen := group.minResultLength()
+ if minLen == 0 {
// Skip empty groups.
continue
}
- samples := group.groupNthRecord(commonLen - 1)
+ // Unwind the samples so that they are aligned on the field value.
+ var samples map[string]*stats.Sample
+ for i := minLen - 1; i >= 0; i-- {
+ candidate := group.groupNthRecord(i)
+ // TODO: consider data interpolation.
+ if candidate[field].Median() >= commonValue {
+ samples = candidate
+ } else {
+ break
+ }
+ }
for key, sample := range samples {
if _, ok := cells[key]; !ok {
cells[key] = make(map[string]string)