From e8a85e90aca4adb472c66f8c42f6d4a41b8cca99 Mon Sep 17 00:00:00 2001 From: Amelia Downs Date: Thu, 30 Sep 2021 11:35:30 -0400 Subject: [PATCH] internal/fuzz: print size of interesting cache This change updates the log lines to clarify that the printed interesting count is only for newly discovered cache entries, and prints the total cache size. It only prints information about interesting entries when coverageEnabled is true. Fixes #48669 Change-Id: I2045afc204764c1842d323e8ae42016fb21b6fb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/353172 Trust: Michael Knyszek Trust: Katie Hockman Reviewed-by: Katie Hockman Reviewed-by: Jay Conrod Run-TryBot: Katie Hockman TryBot-Result: Go Bot --- src/internal/fuzz/fuzz.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/internal/fuzz/fuzz.go b/src/internal/fuzz/fuzz.go index a38036b9d2..87f5459afd 100644 --- a/src/internal/fuzz/fuzz.go +++ b/src/internal/fuzz/fuzz.go @@ -685,7 +685,12 @@ func (c *coordinator) logStats() { } } else { rate := float64(c.count) / time.Since(c.startTime).Seconds() // be more precise here - fmt.Fprintf(c.opts.Log, "fuzz: elapsed: %s, execs: %d (%.0f/sec), interesting: %d\n", c.elapsed(), c.count, rate, c.interestingCount) + if coverageEnabled { + interestingTotalCount := len(c.corpus.entries) - len(c.opts.Seed) + fmt.Fprintf(c.opts.Log, "fuzz: elapsed: %s, execs: %d (%.0f/sec), new interesting: %d (total: %d)\n", c.elapsed(), c.count, rate, c.interestingCount, interestingTotalCount) + } else { + fmt.Fprintf(c.opts.Log, "fuzz: elapsed: %s, execs: %d (%.0f/sec)", c.elapsed(), c.count, rate) + } } } -- 2.50.0