diff --git a/pkg/debugutil/pprof.go b/pkg/debugutil/pprof.go index 2e87124b827d..2df13a7352cd 100644 --- a/pkg/debugutil/pprof.go +++ b/pkg/debugutil/pprof.go @@ -17,10 +17,16 @@ package debugutil import ( "net/http" "net/http/pprof" + "runtime" ) const HTTPPrefixPProf = "/debug/pprof" +func init() { + // 1 out of 5 mutex events are reported, on average + runtime.SetMutexProfileFraction(5) +} + // PProfHandlers returns a map of pprof handlers keyed by the HTTP path. func PProfHandlers() map[string]http.Handler { m := make(map[string]http.Handler) @@ -34,6 +40,7 @@ func PProfHandlers() map[string]http.Handler { m[HTTPPrefixPProf+"/goroutine"] = pprof.Handler("goroutine") m[HTTPPrefixPProf+"/threadcreate"] = pprof.Handler("threadcreate") m[HTTPPrefixPProf+"/block"] = pprof.Handler("block") + m[HTTPPrefixPProf+"/mutex"] = pprof.Handler("mutex") return m }