]> Cypherpunks.ru repositories - gostls13.git/commit
runtime/metrics: add /sync/mutex/wait/total:seconds metric
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 31 Aug 2022 21:34:23 +0000 (21:34 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 16 Sep 2022 16:33:08 +0000 (16:33 +0000)
commit63ceff95fa7cc93dd848b503dedcef53b918cdc3
treed323134cf6afd8ad52dece84728c0916d7ae894c
parent686b38b5b27fe14318adfee57aac780c452fddd6
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>
src/runtime/export_test.go
src/runtime/metrics.go
src/runtime/metrics/description.go
src/runtime/metrics/doc.go
src/runtime/metrics_test.go
src/runtime/proc.go
src/runtime/runtime2.go