From 87deea068a084ea275140927a8b092330ea518a6 Mon Sep 17 00:00:00 2001 From: SHIVAM SHARMA Date: Tue, 14 Feb 2023 11:06:14 +0530 Subject: [PATCH] Add : mutex pprof profile (#731) * add : mutex pprof profile * rm : remove trace from default pprof profiles --- internal/cli/debug_pprof.go | 5 +++-- internal/cli/server/server.go | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/cli/debug_pprof.go b/internal/cli/debug_pprof.go index a979741fda..ca14604b97 100644 --- a/internal/cli/debug_pprof.go +++ b/internal/cli/debug_pprof.go @@ -129,8 +129,9 @@ func (d *DebugPprofCommand) Run(args []string) int { // Only take cpu and heap profiles by default profiles := map[string]string{ - "heap": "heap", - "cpu": "cpu", + "heap": "heap", + "cpu": "cpu", + "mutex": "mutex", } if !d.skiptrace { diff --git a/internal/cli/server/server.go b/internal/cli/server/server.go index 69ac08e993..808b524884 100644 --- a/internal/cli/server/server.go +++ b/internal/cli/server/server.go @@ -8,6 +8,7 @@ import ( "net" "net/http" "os" + "runtime" "strings" "time" @@ -96,6 +97,8 @@ func VerbosityStringToInt(loglevel string) int { //nolint:gocognit func NewServer(config *Config, opts ...serverOption) (*Server, error) { + runtime.SetMutexProfileFraction(5) + srv := &Server{ config: config, }