mirror of
https://github.com/golang/go
synced 2024-11-13 19:10:22 -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:
parent
3e2e80599e
commit
872ca73cad
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user