CentOS 5.4 final下Systemtap的安装(4)

运行 stap -v systemtap.stp 命令,若运行正常则表示systemtap安装成功

[root@localhost systemtap_study]# stap -v monitorJava.stap
Pass 1: parsed user script and 52 library script(s) in 280usr/0sys/293real ms.
Pass 2: analyzed script: 6 probe(s), 4 function(s), 1 embed(s), 4 global(s) in 310usr/350sys/654real ms.
Pass 3: using cached /root/.systemtap/cache/a3/stap_a3128d43c0908f80778e75f469858507_2665.c
Pass 4: using cached /root/.systemtap/cache/a3/stap_a3128d43c0908f80778e75f469858507_2665.ko
Pass 5: starting run.
java process monitoring started ...
4151 kf_sys_read = 14
4151 read = 14
4151 kf_sys_write = 5
4151 write = 5
4049 kf_sys_read = 43
4049 read = 43
4049 kf_sys_write = 13
4049 write = 13
5873 kf_sys_read = 864
5873 read = 864
5873 kf_sys_write = 2
5873 write = 2
5861 kf_sys_read = 2561
5861 read = 2561
5861 kf_sys_write = 29
5861 write = 29
5921 kf_sys_read = 864
5921 read = 864
5921 kf_sys_write = 2
5921 write = 2
5909 kf_sys_read = 2561
5909 read = 2561
5909 kf_sys_write = 29
5909 write = 29
java process monitoring finished
Pass 5: run completed in 0usr/10sys/14408real ms.
[root@localhost systemtap_study]#

三、Cent OS 5.4 Final特殊性说明以及在一般linux系统中systemtap安装步骤

Cent OS 5.4 final在安装操作系统时只要选择了相关软件包即会默认安装上elfutils和systemtap,
 并且不需要重新编译内核,因为其内核默认支持相关的选项,这些选项再下面说明。

假若系统没有安装上面叙述的(1)~(5)的一些rpm包以及elfutils和systemtap,
   则需要首先下载这些rpm包完成(1)~(5)的安装,再重新编译内核,用新内核启动后再安装elfutils和systemtap
  
   编译内核时必须保证内核支持以下选项:
       make menuconfig;配置内核编译选项,按如下方式选择
 General setup  --->
  [*] Kernel->user space relay support (formerly relayfs)
 Kernel hacking  --->
  [*] Kernel debugging
  [*] Compile the kernel with debug info
  [*] Debug Filesystem
 Instrumentation Support  --->
  [*] Kprobes (EXPERIMENTAL)
 Security Options --->
  [*] Default Linux Capabilities

退出时,vi .config 查看内核编译配置文件,
      确保CONFIG_DEBUG_INFO, CONFIG_KPROBES, CONFIG_RELAY,CONFIG_DEBUG_FS这四项选中,使用如下命令
      [root@localhost linux-2.6.25]# grep CONFIG_DEBUG_INFO .config
      CONFIG_DEBUG_INFO=y
      [root@localhost linux-2.6.25]# grep CONFIG_KPROBES .config
      CONFIG_KPROBES=y
      [root@localhost linux-2.6.25]# grep CONFIG_RELAY .config
      CONFIG_RELAY=y
      [root@localhost linux-2.6.25]# grep CONFIG_DEBUG_FS .config
      CONFIG_DEBUG_FS=y
     
    编译内核
       make clean
       make vmlinux modules
       make modules_install
       make bzImage
       make install

用新内核重新启动系统后,安装elfutils*和Systemtap*包

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/24728.html