go-torch 简单使用

go-torch

安装FlameGraph:

  1. git clone https://github.com/brendangregg/FlameGraph.git
  2. 将FlameGraph/flamegraph.pl 加入环境变量$PATH
  3. flamegraph.pl -h 测试

安装go-torch:
1. go get -v github.com/uber/go-torch

修改代码:
1. http 调用:import _ “net/http/pprof”
2. Gin 调用:import "github.com/DeanThompson/ginpprof" r := gin.Default() ginpprof.Wrap(r)

build && run

test:
go-torch -u http://10.8.163.167:6789/ -t 30

火焰图的y轴表示cpu调用方法的先后,x轴表示在每个采样调用时间内,方法所占的时间百分比,越宽代表占据cpu时间越多

猜你喜欢

转载自blog.csdn.net/qq_17612199/article/details/80353355
今日推荐