From 537827702dafc1f4308a4ed9c57f52b779406bcf Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 16 Apr 2024 16:43:07 +0200 Subject: tools/syz-testbed: limit the number of graph data points In long runs, it can be thousands of points for every single graph that we render. It's much more than is actually needed. --- tools/syz-testbed/stats.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/syz-testbed/stats.go b/tools/syz-testbed/stats.go index 1f6bb4443..d45982c2b 100644 --- a/tools/syz-testbed/stats.go +++ b/tools/syz-testbed/stats.go @@ -417,7 +417,19 @@ func (group *RunResultGroup) SaveAvgBenchFile(fileName string) error { return err } defer f.Close() - for _, averaged := range group.AvgStatRecords() { + // In long runs, we collect a lot of stat samples, which results + // in large and slow to load graphs. A subset of 128-256 data points + // seems to be a reasonable enough precision. + records := group.AvgStatRecords() + const targetRecords = 128 + for len(records) > targetRecords*2 { + newRecords := make([]map[string]uint64, 0, len(records)/2) + for i := 0; i < len(records); i += 2 { + newRecords = append(newRecords, records[i]) + } + records = newRecords + } + for _, averaged := range records { data, err := json.MarshalIndent(averaged, "", " ") if err != nil { return err -- cgit mrf-deployment