1
0
mirror of https://github.com/golang/go synced 2024-11-12 09:30:25 -07:00

runtime: don't assume b.N > 0

Change-Id: I2e26717f2563d7633ffd15f4adf63c3d0ee3403f
Reviewed-on: https://go-review.googlesource.com/20856
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Marcel van Lohuizen 2016-03-18 16:41:51 +01:00 committed by Russ Cox
parent 3e2e80599e
commit 872ca73cad

View File

@ -428,6 +428,9 @@ func TestPingPongHog(t *testing.T) {
} }
func BenchmarkPingPongHog(b *testing.B) { func BenchmarkPingPongHog(b *testing.B) {
if b.N == 0 {
return
}
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(1)) defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(1))
// Create a CPU hog // Create a CPU hog