1. golang在window下查看火焰图
功能:查看生产golang程序执行过程中内存,cpu等状态的火焰图
1.1. 目录结构
|goprof
|–goprof.bat
|–graphviz-2.38 这是目录,可以从网上下载安装,拷贝对应目录过来
|–pprof.exe google/pprof
pprof
1.2. 查看命令
新建.bat文件,拷贝下边内容进入,注意下边的 %PProf%
行只能放开一行哈
set Server=127.0.0.1:8999
set PWD=%~dp0
%~d0
cd %PWD%
call %PWD%\config.bat
echo %Server%
set Dot=%PWD%\graphviz-2.38\bin
set PATH=%Dot%;%PATH%
set PProf=%PWD%\pprof.exe
set PPROF_TMPDIR=%PWD%\data
::下边是关于CPU获取的方法
%PProf% -http : C:\work\20190603_190507.cpu.data
::%PProf% -http : -alloc_space http://%Server%/debug/pprof/heap
::%PProf% -http : -inuse_space http://%Server%/debug/pprof/heap
::%PProf% -http : http://%Server%/debug/pprof/profile?seconds=30
::下边是关于内存获取的方法
::%PProf% -http : .\data\pprof.samples.cpu.003.pb.gz
::%PProf% -http : http://%Server%/debug/pprof/heap
::%PProf% -http : -alloc_space http://%Server%/debug/pprof/heap
::%PProf% -http : -inuse_space http://%Server%/debug/pprof/heap