]> Cypherpunks repositories - gostls13.git/commit
testing: don't measure cleanup time after B.Loop
authorAustin Clements <austin@google.com>
Fri, 13 Dec 2024 02:18:44 +0000 (21:18 -0500)
committerGopher Robot <gobot@golang.org>
Mon, 16 Dec 2024 05:41:28 +0000 (21:41 -0800)
commit18b5435fc84225ca303da7a110c7e8065dc4bbda
tree4bb176871845b4915735325b8c703cc0fc000ce6
parentc1f2542c8bef27872a95efd7904afeeee36fe976
testing: don't measure cleanup time after B.Loop

B.Loop resets the timer on the first iteration so that setup code
isn't measured, but it currently leaves the timer running after the
last iteration, meaning that cleanup code will still be measured. Fix
this by stopping the timer when B.Loop returns false to indicate the
end of the benchmark.

Updates #61515

Change-Id: I0e0502cb2ce3c24cf872682b88d74e8be2c4529b
Reviewed-on: https://go-review.googlesource.com/c/go/+/635898
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/testing/benchmark.go
src/testing/loop_test.go