benchstat: don't print geomean of just one benchmark

If there's just one benchmark, the geomean will be the same as the
benchmark result. Omit it.

Change-Id: Id165fa127aa8615015511d6a1da6e1be48b85539
Reviewed-on: https://go-review.googlesource.com/38093
Reviewed-by: Quentin Smith <quentin@golang.org>
diff --git a/benchstat/table.go b/benchstat/table.go
index 0c1c432..190f8ec 100644
--- a/benchstat/table.go
+++ b/benchstat/table.go
@@ -137,6 +137,7 @@
 	row := &Row{Benchmark: "[Geo mean]"}
 	key := Key{Unit: unit}
 	geomeans := []float64{}
+	maxCount := 0
 	for _, key.Config = range c.Configs {
 		var means []float64
 		for _, key.Benchmark = range c.Benchmarks {
@@ -151,6 +152,9 @@
 				means = append(means, m.Mean)
 			}
 		}
+		if len(means) > maxCount {
+			maxCount = len(means)
+		}
 		if len(means) == 0 {
 			row.Metrics = append(row.Metrics, new(Metrics))
 			delta = false
@@ -166,6 +170,12 @@
 			})
 		}
 	}
+	if maxCount <= 1 {
+		// Only one benchmark contributed to this geomean.
+		// Since the geomean is the same as the benchmark
+		// result, don't bother outputting it.
+		return
+	}
 	if delta {
 		row.Delta = fmt.Sprintf("%+.2f%%", ((geomeans[1]/geomeans[0])-1.0)*100.0)
 	}