Open hhstore opened 5 years ago
# gc 内存分配, 栈, 堆, 逃逸分析:
go run -gcflags -m gc_cost.go
go build -gcflags=-m examples/esc/sum.go
bench test
+ pprof
火焰图分析
# cpu:
go test -bench=. -cpuprofile=cpu.prof
# 内存:
go test -bench=. -memprofile=mem.prof
# 浏览器打开火焰图查看:
# cpu 分析:
go tool pprof -http=:8080 cpu.prof
# 内存分析:
go tool pprof -http=:8080 mem.prof
go tool:
bench test + pprof + 火焰图:
go1.11
在go tool pprof
中集成了火焰图(Flame graph)相关项目: