pprof 三把刀
看內存
go tool pprof http://127.0.0.1:6060/debug/pprof/heap?seconds=30
看cpu
go tool pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=30
看協程
go tool pprof http://localhost:6060/debug/pprof/goroutine
端口是自定義的,看看程序內部寫的是什么。
同時記得import
import _ "net/http/pprof"
看火焰圖
go tool pprof -http=:8081 ./pprof.xxx.samples.cpu.001.pb.gz