fgprof golang profiler 支持on cpu 以及off cpu

fgprof 是相比golang 默认pprof 方便的工具,可以用来方便的分析on cpu 以及off cpu ,相比官方的提升不少

说明

没有银弹,fgprof 也有缺点的: 不支持c 函数,当前实现依赖go 的调度器,一些数据可能不准确,parca 也依赖了此包
具体是在parca server 中
参考处理

 
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)
})

参考资料

https://github.com/felixge/fgprof

posted on 2022-09-12 18:18  荣锋亮  阅读(208)  评论(0编辑  收藏  举报

导航