github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/internal/http/pprof.go (about) 1 //go:build debug 2 // +build debug 3 4 package simplehttp 5 6 import ( 7 "net/http" 8 "net/http/pprof" 9 "runtime" 10 ) 11 12 func init() { 13 debug = func(mux *http.ServeMux) { 14 // pprof 15 runtime.MemProfileRate = 100 * 1024 16 mux.HandleFunc("GET /debug/pprof/", pprof.Index) 17 mux.HandleFunc("GET /debug/pprof/cmdline", pprof.Cmdline) 18 mux.HandleFunc("GET /debug/pprof/profile", pprof.Profile) 19 mux.HandleFunc("GET /debug/pprof/symbol", pprof.Symbol) 20 mux.HandleFunc("GET /debug/pprof/trace", pprof.Trace) 21 } 22 }