aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/pprof
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2022-08-30 22:18:01 +0000
committerGopher Robot <gobot@golang.org>2022-09-16 16:32:27 +0000
commita2c396ce00df96f66246aab7a63f3ce5b7ad8753 (patch)
tree0efc1501bd5ac11506acc96c181eacf1dd249b01 /src/runtime/pprof
parentb7c28f484ddbc8267273c997e1bcc83a1391b5f7 (diff)
downloadgo-a2c396ce00df96f66246aab7a63f3ce5b7ad8753.tar.xz
runtime: make the wait reason for a g blocked on a mutex more specific
This change adds 3 new waitReasons that correspond to sync.Mutex.Lock, sync.RWMutex.RLock, and sync.RWMutex.Lock that are plumbed down into semacquire1 by exporting new functions to the sync package from the runtime. Currently these three functions show up as "semacquire" in backtraces which isn't very clear, though the stack trace itself should reveal what's really going on. This represents a minor improvement to backtrace readability, though blocking on an RWMutex.w.Lock will still show up as blocking on a regular mutex (I suppose technically it is). This is a step toward helping the runtime identify when a goroutine is blocked on a mutex of some kind. For #49881. Change-Id: Ia409b4d27e117fe4bfdc25fa541e9c58d6d587b9 Reviewed-on: https://go-review.googlesource.com/c/go/+/427616 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/pprof')
-rw-r--r--src/runtime/pprof/pprof_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go
index 79febc4285..434d106f4a 100644
--- a/src/runtime/pprof/pprof_test.go
+++ b/src/runtime/pprof/pprof_test.go
@@ -1089,7 +1089,7 @@ func blockMutex(t *testing.T) {
var mu sync.Mutex
mu.Lock()
go func() {
- awaitBlockedGoroutine(t, "semacquire", "blockMutex")
+ awaitBlockedGoroutine(t, "sync.Mutex.Lock", "blockMutex")
mu.Unlock()
}()
// Note: Unlock releases mu before recording the mutex event,