美文网首页
pprof工具使用

pprof工具使用

作者: 林海畅游 | 来源:发表于2022-01-13 10:56 被阅读0次

简介

pprof为golang自带的性能检测工具

demo

参考:https://blog.wolfogre.com/posts/go-ppof-practice/

Q&A

1. 如果你的程序,本身不是一个http服务,那么需要做如下操作:

import _ "net/http/pprof"
func main() {
    //yourself code
   //add the next code
   go func() {
       // 启动一个 http server,注意 pprof 相关的 handler 已经自动注册过了
      if err := http.ListenAndServe(":6060", nil); err != nil {
          log.Fatal(err)
      }
      os.Exit(0)
   }
}

2. 如果你的程序,本身就是一个http服务,那么就不用做上述操作,仅执行下述动作:

import _ "net/http/pprof"

参考:https://stackoverflow.com/questions/13699297/how-to-use-pprof-in-go-program

相关文章

  • pprof接口隐藏/认证

    pprof是golang提供的性能分析工具,这里就不过多介绍了。 使用方式很简单,导入pprof包即可 pprof...

  • pprof 工具使用

    pprof golang pprof是golang的可视化和性能分析的工具。其提供了可视化的web页面,火焰图等更...

  • pprof工具使用

    简介 pprof为golang自带的性能检测工具 demo 参考:https://blog.wolfogre.co...

  • go 性能剖析 PProf

    PProf是什么 pprof 是用于可视化和分析性能分析数据的工具 pprof 以 profile.proto 读...

  • 内存泄露

    内存泄露 实战 实战Go内存泄露 - Go语言实战 - SegmentFault 思否 总结 pprof工具 使用...

  • Go语言性能调优工具——pprof

    Go语言性能调优工具——pprof Go语言对性能要求比较高,所以内置了调优工具pprof,本文简单介绍下工具的使...

  • golang性能优化之pprof及其火焰图

    1 pprof简介 golang代码的性能监控使用pprof包来做。pprof有两个包: runtime/ppro...

  • Go 调试

    Go的pprof使用 web服务器 import _"net/http/pprof" go func() { ...

  • 【实践】WINDOWS下GOlang性能测试分析工具PProf&

    1.摘要 本文讲解在Windows 10操作系统VS Code集成环境下,如何使用GO语言的PProf工具进行性能...

  • go 的性能分析工具 pprof

    pprof 功能有2种开启方式,对应两种包: net/http/pprof:使用服务器的场景 runtime/pp...

网友评论

      本文标题:pprof工具使用

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