美文网首页
go pprof的安装使用

go pprof的安装使用

作者: loki528 | 来源:发表于2019-05-24 10:58 被阅读0次

    下载Graphviz 为pprof的输出提供图形化的显示

    https://graphviz.gitlab.io/_pages/Download/Download_windows.html

    添加dot.exe的路劲到环境变量

    D:\Program Files (x86)\Graphviz2.38\bin

    在 main 方法中增加

    import _ "net/http/pprof"

    func main() {

        go func() {

            http.ListenAndServe("localhost:6060", nil)

        }()

    然后就可以在浏览器中使用http://localhost:port/debug/pprof/直接看到当前web服务的状态,包括CPU占用情况和内存使用情况等。

    参考 https://studygolang.com/articles/7069

    https://studygolang.com/articles/14519?fr=sidebar

    相关文章

      网友评论

          本文标题:go pprof的安装使用

          本文链接:https://www.haomeiwen.com/subject/wnowzqtx.html