From e31218e607e3dfbc8f7d5d673962c647b317174a Mon Sep 17 00:00:00 2001 From: andyzhang2023 <147463846+andyzhang2023@users.noreply.github.com> Date: Mon, 14 Oct 2024 13:16:20 +0800 Subject: [PATCH] enable block and mutex profiling in pprof (#6) Co-authored-by: andyzhang2023 --- internal/debug/flags.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/debug/flags.go b/internal/debug/flags.go index dac878a7b1..1f7b106fa7 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -314,6 +314,8 @@ func StartPProf(address string, withMetrics bool) { exp.Exp(metrics.DefaultRegistry) } http.Handle("/memsize/", http.StripPrefix("/memsize", &Memsize)) + runtime.SetBlockProfileRate(1) + runtime.SetMutexProfileFraction(1) log.Info("Starting pprof server", "addr", fmt.Sprintf("http://%s/debug/pprof", address)) go func() { if err := http.ListenAndServe(address, nil); err != nil {