]> Cypherpunks repositories - gostls13.git/commitdiff
internal/fuzz: print size of interesting cache
authorAmelia Downs <adowns@vmware.com>
Thu, 30 Sep 2021 15:35:30 +0000 (11:35 -0400)
committerKatie Hockman <katie@golang.org>
Mon, 4 Oct 2021 20:57:50 +0000 (20:57 +0000)
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 <mknyszek@google.com>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

src/internal/fuzz/fuzz.go

index a38036b9d2576def0ad62b10f6ab029ef9c4da2a..87f5459afd5575c39e42c3e4761d6a18b81e165e 100644 (file)
@@ -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)
+               }
        }
 }