e8a767b609
Currently TestMutexProfile expects contention to reported as somewhere between 0.9x and 2.0x the expected amount introduced. While bounding from below is fine (especially since the goroutine holding the mutex doesn't even start to sleep until the required number of goroutines are blocked on a mutex), bounding from above can easily lead to flakiness. Delays and non-determinism can come from anywhere in the system, and nevertheless clocks keep ticking. The result is that goroutines could easily appear to be blocked on a mutex much longer than just the sleep time. However, the contention upper bound is still useful, especially for identifying wildly incorrect values. Set the contention total to be proportional to the total wall-time spent in the actual sampling mutex block sampling portion of the code. This should be a generous upper-bound on how much contention there could be, because it should in theory capture any delays from the environment in it as well. Still, rounding errors could be an issue, and on Windows the time granularity is quite low (~15ms, or 15% of what each goroutine is supposed to add to the mutex profile), so getting unlucky with where time measurements fall within each tick could also be a problem. Add an extra 10%, which seems to make it much less likely to fail in a Windows gomote. Fixes #62094. Change-Id: I59a10a73affd077185dada8474b91d0bc43b4a43 Reviewed-on: https://go-review.googlesource.com/c/go/+/520635 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Knyszek <mknyszek@google.com> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
codereview.cfg | ||
CONTRIBUTING.md | ||
go.env | ||
LICENSE | ||
PATENTS | ||
README.md | ||
SECURITY.md |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 4.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.