]> Cypherpunks.ru repositories - gostls13.git/commitdiff
testing: always ignore RunParallel in probe phase
authorMarcel van Lohuizen <mpvl@golang.org>
Fri, 18 Mar 2016 15:43:43 +0000 (16:43 +0100)
committerRuss Cox <rsc@golang.org>
Fri, 18 Mar 2016 16:23:51 +0000 (16:23 +0000)
Change-Id: If45410a2d7e48d1c9e6800cd98f81dd89024832c
Reviewed-on: https://go-review.googlesource.com/20852
Reviewed-by: Russ Cox <rsc@golang.org>
src/testing/benchmark.go

index ef169634014b7f1ae093e2038c4d595c4a103c69..3e85392d03ad360163c8b32274a5f72a7f7b774a 100644 (file)
@@ -535,8 +535,11 @@ func (pb *PB) Next() bool {
 // The body function will be run in each goroutine. It should set up any
 // goroutine-local state and then iterate until pb.Next returns false.
 // It should not use the StartTimer, StopTimer, or ResetTimer functions,
-// because they have global effect.
+// because they have global effect. It should also not call Run.
 func (b *B) RunParallel(body func(*PB)) {
+       if b.N == 0 {
+               return // Nothing to do when probing.
+       }
        // Calculate grain size as number of iterations that take ~100µs.
        // 100µs is enough to amortize the overhead and provide sufficient
        // dynamic load balancing.