fgprof 是相比golang 默认pprof 方便的工具,可以用来方便的分析on cpu 以及off cpu ,相比官方的提升不少
说明
internalMux.HandleFunc("/debug/pprof/*", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/debug/pprof/profile" {
pprof.Profile(w, r)
return
}
if r.URL.Path == "/debug/pprof/fgprof" {
fgprof.Handler().ServeHTTP(w, r)
return
}
pprof.Index(w, r)
})