文档中未明确提及它,而
net/http/pprof仅将其处理程序注册到
http.DefaultServeMux。
从来源:
func init() { http.Handle("/debug/pprof/", http.HandlerFunc(Index)) http.Handle("/debug/pprof/cmdline", http.HandlerFunc(Cmdline)) http.Handle("/debug/pprof/profile", http.HandlerFunc(Profile)) http.Handle("/debug/pprof/symbol", http.HandlerFunc(Symbol)) http.Handle("/debug/pprof/trace", http.HandlerFunc(Trace))}如果您未使用默认的多路复用器,则只需向您要使用的任何多路复用器注册所需的任何/全部,例如,诸如此类
mymux.HandleFunc("…",pprof.Index)。或者,您可以使用默认的mux在单独的端口(如果需要的话,也可以绑定到localhost)上监听。



