为什么80%的码农都做不了架构师?>>>
一 准备
查看内核版本
复制代码
1uname -a
下载内核开发补丁
http://debuginfo.centos.org/6/x86_64/ CentOS系统可以从链接里找自己对应内核版本的补丁
以我虚拟机威力需要下载如下三个包
kernel-debug-debuginfo-2.6.32-573.el6.x86_64.rpm
kernel-debuginfo-2.6.32-573.el6.x86_64.rpm
kernel-debuginfo-common-x86_64-2.6.32-573.el6.x86_64.rpm
安装
1.装rpm包
复制代码
1
2rpm -ivh * yum install systemtap
2.安装openresty
重新编译openresty,打开debug选项
3.下载Flame-Graphic生成包
https://github.com/brendangregg/FlameGraph
二. 使用
1.测试systemtap是否安装成功
复制代码
1
2
3
4
5
6
7
8# stap -v -e 'probe vfs.read {printf("read performedn"); exit()}' Pass 1: parsed user script and 103 library script(s) using 201628virt/29508res/3144shr/26860data kb, in 10usr/190sys/219real ms. Pass 2: analyzed script: 1 probe(s), 1 function(s), 3 embed(s), 0 global(s) using 296120virt/124876res/4120shr/121352data kb, in 660usr/1020sys/1889real ms. Pass 3: translated to C into "/tmp/stapffFP7E/stap_82c0f95e47d351a956e1587c4dd4cee1_1459_src.c" using 296120virt/125204res/4448shr/121352data kb, in 10usr/50sys/56real ms. Pass 4: compiled C into "stap_82c0f95e47d351a956e1587c4dd4cee1_1459.ko" in 620usr/620sys/1379real ms. Pass 5: starting run. read performed Pass 5: run completed in 20usr/30sys/354real ms.
2. 画图
复制代码
1
2
3
4
5
6
7
8
9
10
11
12#!/bin/bash pid=$1 t=$2 filepath=$(cd "$(dirname "$0")"; pwd) echo ${filepath} cd ${filepath} ./nginx-systemtap-toolkit-master/ngx-sample-lua-bt -p ${pid} --luajit20 -t ${t} > result/tmp.bt ./nginx-systemtap-toolkit-master/fix-lua-bt result/tmp.bt > result/flame.bt ./FlameGraph-master/stackcollapse-stap.pl result/flame.bt > result/flame.cbt ./FlameGraph-master/flamegraph.pl result/flame.cbt > result/flame.svg bash /opt/flamegraph/make_svg.sh 29857 60 # 执行脚本,指定nginx其中一个线程pid,和脚本执行时间
参考链接:https://moonbingbing.gitbooks.io/openresty-best-practices/content/flame_graph/install.html
转载于:https://my.oschina.net/MaTech/blog/639999
最后
以上就是安静服饰最近收集整理的关于安装火焰图生成工具的全部内容,更多相关安装火焰图生成工具内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复