pprof stuff for debugging

This commit is contained in:
2026-06-24 17:05:41 +01:00
parent 2ae29af199
commit 6dd4db0358
+11 -1
View File
@@ -4,7 +4,9 @@ import (
"fmt"
"log/slog"
"net/http"
"net/http/pprof"
"os"
"runtime"
"esdi/cmd"
"esdi/config"
@@ -59,11 +61,19 @@ func setupLogger() error {
func runStatviz() error {
mux := http.NewServeMux()
err := statsviz.Register(mux)
err := statsviz.Register(mux, statsviz.Root("/"))
if err != nil {
return err
}
runtime.SetBlockProfileRate(1)
runtime.SetMutexProfileFraction(1)
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
go func() {
err := http.ListenAndServe("localhost:8001", mux)
if err != nil {