From 8ec1c9e2850c642e3ebd0ea3a9749dd13cd4545a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20Geisend=C3=B6rfer?= Date: Wed, 2 Nov 2022 09:28:54 +0100 Subject: [PATCH] testing: Document RunParallel ns/op behavior Updates #31884 Change-Id: Ibad3d31038a8426c0bce61c1726392880f934865 Reviewed-on: https://go-review.googlesource.com/c/go/+/447136 Reviewed-by: Bryan Mills Run-TryBot: Bryan Mills Reviewed-by: Benny Siegert Auto-Submit: Bryan Mills TryBot-Result: Gopher Robot --- src/testing/benchmark.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/testing/benchmark.go b/src/testing/benchmark.go index 31fc7d7156..be9b87f80b 100644 --- a/src/testing/benchmark.go +++ b/src/testing/benchmark.go @@ -777,6 +777,9 @@ func (pb *PB) Next() bool { // 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. It should also not call Run. +// +// RunParallel reports ns/op values as wall time for the benchmark as a whole, +// not the sum of wall time or CPU time over each parallel goroutine. func (b *B) RunParallel(body func(*PB)) { if b.N == 0 { return // Nothing to do when probing. -- 2.50.0