pprof stuff for debugging
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user