博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
制作火焰图(纯笔记)
阅读量:7098 次
发布时间:2019-06-28

本文共 2217 字,大约阅读时间需要 7 分钟。

安装systemtap

按照官网说的安装:

我的操作系统是centos

uname -rm:

2.6.18-164.el5xen x86_64

yum install systemtap

wget 

wget 

[root@test34x-nova ~/software]# rpm -Uhv kernel-debuginfo-*rpm 

warning: kernel-debuginfo-2.6.18-164.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897 
Preparing...                ########################################### [100%] 
   1:kernel-debuginfo-common########################################### [ 50%] 
   2:kernel-debuginfo       ########################################### [100%]

测试是否安装成功

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

提示:

Checking "/lib/modules/2.6.32-279.el6.x86_64/build/.config" failed with error: 没有那个文件或目录

Incorrect version or missing kernel-devel package, use: yum install kernel-devel-2.6.32-279.el6.x86_64

下载Flame Graph

比如我放在这个目录里:

/home/yejianfeng/software/FlameGraph-master

下面拿nginx的一个模块来进行测试

这里有个自己写的mysecret2的模块

安装配置好,确保能访问

写一个systemtrap脚本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
global 
s;
global 
quit = 0;
probe timer.profile {
if
(pid() == target()) {
if 
(quit) {
foreach 
(i in s-) {
print_ustack(i);
printf(
"\t%d\n"
, @
count
(s[i]));
}
exit
;
}
else 
{
s[ubacktrace()] <<< 1;
}
}
}
probe timer.s(20) {
quit = 1;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<P>[root@test34x-nova ~/handcode]# stap --ldd -d
/home/yejianfeng/nginx/nginx/sbin/nginx --all-modules -D MAXMAPENTRIES=256 -D
MAXACTION=20000 -D MAXTRACE=100 -D MAXSTRINGLEN=4096 -D MAXBACKTRACE=100 -x
26150 /home/yejianfeng/handcode/ngx.stp --vp 0001 &gt;
/home/yejianfeng/ngx.out&nbsp;
<P>WARNING: never-assigned local variable
'exit' 
(alternatives: i s quit):
identifier
'exit' 
at /home/yejianfeng/handcode/ngx.stp:10:4
<P>&nbsp;source:
exit
;
<P>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^
<P>WARNING: Eliding side-effect-free expression : identifier
'exit' 
at :10:4
<P>&nbsp;source:
exit
;
<P>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^
<P>WARNING: missing unwind/symbol data
for 
module
'kernel'
<P>WARNING: missing unwind/symbol data
for 
module
'uprobes'
<P>Pass 4: compiled C into
"stap_7ee66ba3cf5480d819b30e4f49bf3bb1_3633.ko" 
in
5560usr/1320sys/9525real ms.
<P>WARNING: /usr/bin/staprun exited with status: 1
<P>Pass 5: run failed. &nbsp;Try again with another
'--vp 00001' 
option.</P>

 

 

纯笔记。。。搞了半天没搞出来。。。MMD。。。水平太搓了。。。

转载地址:http://durql.baihongyu.com/

你可能感兴趣的文章
2018年全国大学生电子设计竞赛
查看>>
三层交换+DHCP实验详解
查看>>
C - Common Subsequence
查看>>
如何以特定的时间间隔为图片添加动画效果?
查看>>
虚拟机mac 与主机的网络共享
查看>>
02 管理企业
查看>>
EventID 6398
查看>>
DNS服务器搭建
查看>>
页面生成周期中的两个Application池的详情小弟了解
查看>>
localhost与127.0.0.1的区别是什么?
查看>>
机器学习算法汇总:人工神经网络、深度学习及其它
查看>>
Android下Affinities和Task
查看>>
我们应该如何对待开源?——看完ssh有感
查看>>
启动Android模拟器报 “The connection to adb is down, and a severe error has occured.”的错误...
查看>>
activity跳转动画
查看>>
THE OVERARCHING PROCESS OF TEST DESIGN
查看>>
Linux 网络编程之 Select
查看>>
Gym 101194H 2016 ecfinal H题
查看>>
upper_bound()与lower_bound()的使用
查看>>
Aix项目_shell_rsh_01
查看>>