diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2021-12-03 19:12:47 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2021-12-06 14:29:36 +0100 |
| commit | 40ec852a0b6073c78a43148b36ba9ef67954e18b (patch) | |
| tree | 79aa759dda87fe57b8b794f26271e897039311de /tools/syz-testbed/stats.go | |
| parent | 19bd435f7d6275cbfbb01c354c45ab0df0df395c (diff) | |
tools/syz-testbed: add a bug count table
This table does not just collect YES/NO, but also shows the number of
test runs in which syz-manager has discovered the given bug.
Diffstat (limited to 'tools/syz-testbed/stats.go')
| -rw-r--r-- | tools/syz-testbed/stats.go | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/tools/syz-testbed/stats.go b/tools/syz-testbed/stats.go index 20ad9bb30..1ff4af4d0 100644 --- a/tools/syz-testbed/stats.go +++ b/tools/syz-testbed/stats.go @@ -95,8 +95,9 @@ func groupSamples(records []StatRecord) map[string]*stats.Sample { } type BugSummary struct { - title string - found map[string]bool + title string + found map[string]bool + resultsCount map[string]int // the number of run results that have found this bug } // If there are several instances belonging to a single checkout, we're interested in the @@ -109,12 +110,14 @@ func summarizeBugs(groups []RunResultGroup) ([]*BugSummary, error) { summary := bugsMap[bug.Title] if summary == nil { summary = &BugSummary{ - title: bug.Title, - found: make(map[string]bool), + title: bug.Title, + found: make(map[string]bool), + resultsCount: make(map[string]int), } bugsMap[bug.Title] = summary } summary.found[group.Name] = true + summary.resultsCount[group.Name]++ } } } @@ -146,6 +149,28 @@ func (view StatView) GenerateBugTable() (*Table, error) { return table, nil } +func (view StatView) GenerateBugCountsTable() (*Table, error) { + table := NewTable("Bug") + for _, group := range view.Groups { + table.AddColumn(group.Name) + } + summaries, err := summarizeBugs(view.Groups) + if err != nil { + return nil, err + } + for _, bug := range summaries { + for _, group := range view.Groups { + if bug.found[group.Name] { + count := bug.resultsCount[group.Name] + percent := float64(count) / float64(len(group.Results)) * 100.0 + value := fmt.Sprintf("%v (%.1f%%)", count, percent) + table.Set(bug.title, group.Name, value) + } + } + } + return table, nil +} + func (group RunResultGroup) AvgStatRecords() []map[string]uint64 { ret := []map[string]uint64{} commonLen := group.minResultLength() |
