From: Felix Geisendörfer Date: Wed, 2 Nov 2022 08:28:54 +0000 (+0100) Subject: testing: Document RunParallel ns/op behavior X-Git-Tag: go1.20rc1~405 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8ec1c9e2850c642e3ebd0ea3a9749dd13cd4545a;p=gostls13.git 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 --- 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.