日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

openresty火焰图安装

發(fā)布時間:2023/12/31 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 openresty火焰图安装 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

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目錄下,執(zhí)行

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,這便是火焰圖,用瀏覽器打開即可。

?

轉(zhuǎn)載于:https://www.cnblogs.com/wangzhisdu/p/7779190.html

總結

以上是生活随笔為你收集整理的openresty火焰图安装的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。