benchstat: omit 0 values from geomean

This makes the geomean undefined (or zero, depending on who you ask).
Since these usually come from counts, it's more informative to just
omit the benchmark.

Change-Id: Ia426955784cf12fea19b3d5e51a49a436cbc81c6
Reviewed-on: https://go-review.googlesource.com/38092
Reviewed-by: Quentin Smith <quentin@golang.org>
diff --git a/benchstat/table.go b/benchstat/table.go
index 780e422..0c1c432 100644
--- a/benchstat/table.go
+++ b/benchstat/table.go
@@ -141,7 +141,13 @@
 		var means []float64
 		for _, key.Benchmark = range c.Benchmarks {
 			m := c.Metrics[key]
-			if m != nil {
+			// Omit 0 values from the geomean calculation,
+			// as these either make the geomean undefined
+			// or zero (depending on who you ask). This
+			// typically comes up with things like
+			// allocation counts, where it's fine to just
+			// ignore the benchmark.
+			if m != nil && m.Mean != 0 {
 				means = append(means, m.Mean)
 			}
 		}