pprof
安装生成火焰图工具
go get github.com/uber/go-torch
下载graphviz
MacOS
brew install graphviz
Ubuntu
sudo apt-get install graphviz
Centos
yum install graphviz
net/http pprof
1 | import _ "net/http/pprof" |
gin pprof
1 | import "github.com/gin-contrib/pprof" |
go tool
打开pprof可视化页面
1 | go tool pprof -http=:9090 http://localhost:9001/debug/pprof/profile?seconds=60 |


打开一个交互页面
-inuse_space: 分析程序常驻内存的占用情况
-alloc_objects:分析内存的临时分配情况
1 | go tool pprof -inuse_space http://localhost:9001/debug/pprof/heap |
