pprof stuff for debugging
This commit is contained in:
@@ -4,7 +4,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"esdi/cmd"
|
"esdi/cmd"
|
||||||
"esdi/config"
|
"esdi/config"
|
||||||
@@ -59,11 +61,19 @@ func setupLogger() error {
|
|||||||
|
|
||||||
func runStatviz() error {
|
func runStatviz() error {
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
err := statsviz.Register(mux)
|
err := statsviz.Register(mux, statsviz.Root("/"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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() {
|
go func() {
|
||||||
err := http.ListenAndServe("localhost:8001", mux)
|
err := http.ListenAndServe("localhost:8001", mux)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user