From f0e94da92f1381e56ecd1c28575aaac54cdfc79d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 31 May 2024 10:18:58 +0200 Subject: tools/syz-testbed: allow to view unaligned records This is useful if instances run for different amount of time. It's hard to make any sense out of aligned records in that case. --- tools/syz-testbed/html.go | 3 --- tools/syz-testbed/stats.go | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'tools/syz-testbed') diff --git a/tools/syz-testbed/html.go b/tools/syz-testbed/html.go index 679099a8a..c28020df3 100644 --- a/tools/syz-testbed/html.go +++ b/tools/syz-testbed/html.go @@ -203,9 +203,6 @@ func (ctx *TestbedContext) genSimpleTableController(method func(view StatView) ( func (ctx *TestbedContext) httpMainStatsTable(urlPrefix string, view StatView, r *http.Request) (*uiTable, error) { alignBy := r.FormValue("align") - if alignBy == "" { - alignBy = "fuzzing" - } table, err := view.AlignedStatsTable(alignBy) if err != nil { return nil, fmt.Errorf("stat table generation failed: %w", err) diff --git a/tools/syz-testbed/stats.go b/tools/syz-testbed/stats.go index 8a3a368eb..8c20d495e 100644 --- a/tools/syz-testbed/stats.go +++ b/tools/syz-testbed/stats.go @@ -251,12 +251,35 @@ func (group RunResultGroup) groupNthRecord(i int) map[string]*stats.Sample { return groupSamples(records) } +func (group RunResultGroup) groupLastRecord() map[string]*stats.Sample { + records := []StatRecord{} + for _, result := range group.SyzManagerResults() { + n := len(result.StatRecords) + if n == 0 { + continue + } + records = append(records, result.StatRecords[n-1]) + } + return groupSamples(records) +} + func (view StatView) StatsTable() (*Table, error) { return view.AlignedStatsTable("uptime") } func (view StatView) AlignedStatsTable(field string) (*Table, error) { // We assume that the stats values are nonnegative. + table := NewTable("Property") + if field == "" { + // Unaligned last records. + for _, group := range view.Groups { + table.AddColumn(group.Name) + for key, sample := range group.groupLastRecord() { + table.Set(key, group.Name, NewValueCell(sample)) + } + } + return table, nil + } var commonValue float64 for _, group := range view.Groups { minLen := group.minResultLength() @@ -273,7 +296,6 @@ func (view StatView) AlignedStatsTable(field string) (*Table, error) { commonValue = currValue } } - table := NewTable("Property") for _, group := range view.Groups { table.AddColumn(group.Name) minLen := group.minResultLength() -- cgit mrf-deployment