lua安装火焰图

之前安装时候记录的过程,贴一下

安装火焰图

安装systemtap

其实主要就是安装内核探测工具 systemtap(SystemTap 通过将脚本语句翻译成C语句,编译成内核模块。模块加载之后,依据时间处理机制来收集有关正在运行的Linux系统的信息)

    1. yum install yum-utils

    2. yum install kernel-devel

    3. debuginfo-install kernel

    4. yum install systemtap

第三步安装失败的话,使用内核版本号找到对应的包(uname -r )进行安装就好了。[从 http://debuginfo.centos.org/6/x86_64/ el6 下载]

找到对应centos及内核版本的包,如7/x86_64下的kernel-debuginfo-common-x86_64-3.10.0-229.el7.x86_64.rpmkernel-debuginfo-3.10.0-229.el7.x86_64.rpm,然后用rpm -ivh 安装就行了,需要先安装common

安装好之后测试: 

stap -ve 'probe begin { log("hello world") exit() }'



查看luajit 是否 debug模式安装 stripped


make CCDEBUG=-g&&make install prefix=/usr/local/bin/luajit

注意安装luajit 需要重启一下才会生效 【忽略】

file /usr/local/bin/luajit-2.0.4

debug模式安装luajit

[root@iZ23cvk1s94Z LuaJIT-2.0.4]# file /usr/local/bin/luajit-2.0.4

/usr/local/bin/luajit-2.0.4: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped 

若没安装成功 make clean 再重新安装


openresty-systemtap-toolkit-master/ngx-sample-lua-bt -p 11701 --luajit20 -t 5 > a.bt



使用示例

1.找到我们要监控的nginx的某个进程
ps -ef | grep nginx


2.ngx-sample-lua-bt 抓取栈信息(这个工具可以看到在某个文件对应行函数的情况)
此处我是把上面下载的openresty-systemtap-toolkitFlameGraph加到环境变量里面去了。所以直接输入命令就行了

ngx-sample-lua-bt -p 28510 --luajit20 -t 5 > temp.bt

openresty-systemtap-toolkit-master/ngx-sample-lua-bt -p 14518 --luajit20 -t 5 >temp20180209.bt

openresty-systemtap-toolkit-master/ngx-sample-lua-bt --luajit20 -p 10740 -t 5 > temp20180313.bt


3.使用fix-lua-bt把上面得到的文件转化更友好点(直接看到对应的lua函数)

fix-lua-bt temp.bt > a.bt

openresty-systemtap-toolkit-master/fix-lua-bt temp20180313.bt > a20180313.bt

4.使用下面两个FlameGraph中的命令将文件转化为svg图片

stackcollapse-stap.pl a.bt > a.cbt

flamegraph.pl a.cbt > a.svg

FlameGraph-master/stackcollapse-stap.pl a20180209.bt >a20180209.cbt

FlameGraph-master/flamegraph.pl a20180209.cbt >a20180209.svg


安装过程遇到的问题



[root@iZbp19x98x8whxmbtfudqsZ ~]# openresty-systemtap-toolkit-master/ngx-sample-lua-bt -p 18347 --luajit20 -t 10 > temp20180118.bt

semantic error: while resolving probe point: identifier 'process' at <input>:11:7

        source: probe process("/usr/local/nginx/sbin/nginx").function("lua_resume"),

                      ^


semantic error: no match (similar functions: lua_resume, lua_remove, CMAC_resume, lua_replace, luaL_gsub)


Pass 2: analysis failed.  [man error::pass2]

Number of similar error messages suppressed: 2.

Rerun with -v to see them.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值