diff options
| author | Michael Anthony Knyszek <mknyszek@google.com> | 2022-08-31 21:34:23 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-09-16 16:33:08 +0000 |
| commit | 63ceff95fa7cc93dd848b503dedcef53b918cdc3 (patch) | |
| tree | d323134cf6afd8ad52dece84728c0916d7ae894c /src/runtime/metrics/description.go | |
| parent | 686b38b5b27fe14318adfee57aac780c452fddd6 (diff) | |
| download | go-63ceff95fa7cc93dd848b503dedcef53b918cdc3.tar.xz | |
runtime/metrics: add /sync/mutex/wait/total:seconds metric
This change adds a metric to the runtime/metrics package which tracks
total mutex wait time for sync.Mutex and sync.RWMutex. The purpose of
this metric is to be able to quickly get an idea of the total mutex wait
time.
The implementation of this metric piggybacks off of the existing G
runnable tracking infrastructure, as well as the wait reason set on a G
when it goes into _Gwaiting.
Fixes #49881.
Change-Id: I4691abf64ac3574bec69b4d7d4428b1573130517
Reviewed-on: https://go-review.googlesource.com/c/go/+/427618
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/metrics/description.go')
| -rw-r--r-- | src/runtime/metrics/description.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/metrics/description.go b/src/runtime/metrics/description.go index abcdddd16c..dcfe01e67c 100644 --- a/src/runtime/metrics/description.go +++ b/src/runtime/metrics/description.go @@ -366,6 +366,12 @@ var allDesc = []Description{ Description: "Distribution of the time goroutines have spent in the scheduler in a runnable state before actually running.", Kind: KindFloat64Histogram, }, + { + Name: "/sync/mutex/wait/total:seconds", + Description: "Approximate cumulative time goroutines have spent blocked on a sync.Mutex or sync.RWMutex. This metric is useful for identifying global changes in lock contention. Collect a mutex or block profile using the runtime/pprof package for more detailed contention data.", + Kind: KindFloat64, + Cumulative: true, + }, } // All returns a slice of containing metric descriptions for all supported metrics. |
