openresty火焰图安装
1、下載systemtap安裝包并安裝
從https://sourceware.org/systemtap/ftp/releases/下載最新版的systemtap.tar.gz壓縮包
我安裝的時候,最新版本是3.2
wget?https://sourceware.org/systemtap/ftp/releases/systemtap-3.2.tar.gz?--no-check-certificate
解壓
./configure
報錯1
configure: error: missing elfutils development headers/libraries (install elfutils-devel, libebl-dev, libdw-dev and/or libebl-devel)
yum install elfutils-devel
報錯2
configure:
configure: For a private or temporary build of systemtap, we recommend
configure: configuring with a prefix. For example, try
configure: ./configure python='/usr/bin/python' pyexecdir='${exec_prefix}/lib64/python2.6/site-packages' --prefix=/root/systemtap-3.2-9194
configure: Running systemtap uninstalled, entirely out of the build tree,
configure: is not supported.
./configure python='/usr/bin/python' pyexecdir='${exec_prefix}/lib64/python2.6/site-packages' --prefix=/root/systemtap-3.2-9194
make; make install
安裝完成之后,在systemtap目錄下,執行
stap -ve 'probe begin { log("hello systemtap!") exit() }'
如果提示pass 5: run completed ... 就表示安裝成功。
2、下載
該工具包即是用perl生成stap探測腳本并運行的腳本,如果是要抓Lua級別的情況,請使用工具 ngx-sample-lua-bt
wget https://github.com/brendangregg/openresty-systemtap-toolkit/archive/master.zip?--no-check-certificate
該工具包中包含多個火焰圖生成工具,其中,stackcollapse-stap.pl才是為SystemTap抓取的棧信息的生成工具
wget https://github.com/brendangregg/FlameGraph/archive/master.zip?--no-check-certificate
3、測試
ps -ef|grep nginx
查詢nginx worker process的進程號
在openresty-systemtap-toolkit下
?
./ngx-sample-lua-bt -p 15010 --luajit20 -t 5 > tmp.bt (-p 是要抓的進程的pid --luajit20|--luajit51 是LuaJIT的版本 -t是探測的時間,單位是秒, 探測結果輸出到tmp.bt)
./fix-lua-bt tmp.bt > flame.bt (處理ngx-sample-lua-bt的輸出,使其可讀性更佳)
在FlameGraph下
./stackcollapse-stap.pl flame.bt > flame.cbt
./flamegraph.pl flame.cbt > flame.svg
如果一切正常,那么會生成flame.svg,這便是火焰圖,用瀏覽器打開即可。
?
轉載于:https://www.cnblogs.com/wangzhisdu/p/7779190.html
總結
以上是生活随笔為你收集整理的openresty火焰图安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ActiveMQ的安装搭建
- 下一篇: 科技昨夜今晨 0718:腾讯回应微信号被