[dev.fuzz] internal/fuzz: include coverage in logged stats

Change-Id: I51ec70b69e802fd0d962ba9544e96e29b1627fef
Reviewed-on: https://go-review.googlesource.com/c/go/+/319590
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
This commit is contained in:
Roland Shoemaker 2021-05-12 18:25:20 -07:00
parent 9f79597526
commit 54f067812d
1 changed files with 7 additions and 3 deletions

View File

@ -465,14 +465,18 @@ func (c *coordinator) updateStats(result fuzzResult) {
}
func (c *coordinator) logStats() {
// TODO(jayconrod,katiehockman): consider printing the amount of coverage
// that has been reached so far (perhaps a percentage of edges?)
elapsed := time.Since(c.startTime)
if c.coverageOnlyRun() {
fmt.Fprintf(c.opts.Log, "gathering baseline coverage, elapsed: %.1fs, workers: %d, left: %d\n", elapsed.Seconds(), c.opts.Parallel, c.covOnlyInputs)
} else {
rate := float64(c.count) / elapsed.Seconds()
fmt.Fprintf(c.opts.Log, "fuzzing, elapsed: %.1fs, execs: %d (%.0f/sec), workers: %d, interesting: %d\n", elapsed.Seconds(), c.count, rate, c.opts.Parallel, c.interestingCount)
edges, hits := len(c.coverageData), 0
for _, c := range c.coverageData {
if c > 0 {
hits++
}
}
fmt.Fprintf(c.opts.Log, "fuzzing, elapsed: %.1fs, execs: %d (%.0f/sec), workers: %d, interesting: %d, coverage: %d/%d\n", elapsed.Seconds(), c.count, rate, c.opts.Parallel, c.interestingCount, hits, edges)
}
}