首页 技术 正文
技术 2022年11月17日
0 收藏 317 点赞 3,761 浏览 1649 个字

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,这便是火焰图,用浏览器打开即可。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,104
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,580
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,428
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,200
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,835
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,918