Install systemtap on Ubuntu 14.04

What is systemtap?

There are several articles can answer this question:

Install systemtap

It is better read this reference before installing, although you can not trust on it completely because of some
content is legacy.
https://wiki.ubuntu.com/Kernel/Systemtap
PRE-INSTALL

  • Ubuntu 14.04 x86-64
    kernel version: 3.13.0-39 root privilege, in order to keep convinient, or you have to create a new user staper etc.

INSTALL
Very important thing is installing corresponding debug symbol image .
There are two resolution:

  1. Build from kernel source

  • Download kernel source from kernel.org

  • Usemake-kpkgto generate kernel image, kernel debug symbol image and kernel headers. I love this tool, please google it for help.

  • Thendpkg -i ***, * indicate the generated Debian packages.

  1. Use available debug images for your running kernel, BUT you may not be always lucky!

I have tried the first solution, BUT It always complains that the debug symbol image does not match the kernel image for unknown reason. If you success at this solution, please tell me :-P.

So, I use the second solution instead. After that, do
#apt-get install systemtap

POST-INSTALL
In order to test if the systemtap is ok, do
#systap-prep
If nothing complains, it is ok!

Install systemtap IDE

Please read this reference first, please do not trust on it fully!
http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.linuxtools.systemtap.ui.doc%2FLinux_Tools_Project%2FSystemtap%2FUser_Guide%2FSystemTap-IDE.html.

  • Download the newest eclipse(LUNA for me), of course java runtime should be installed properly.

  • Start eclipe with root privilege ,install systemtap IDE as the help page.

Run a simple test case

This simple script will dispaly the counting number of read and write syscall respectively in 1s.

  • Fanially, refer to the help page, do this simple test.

global read, write, start

probe begin { 
     start = gettimeofday_s() 
 }

probe syscall.write
 { 
     write += count
 }

probe syscall.read 
{
     read += count 
}

probe timer.ms(1000) 
{
   printf("%d\t%d\t%d\n", (gettimeofday_s()-start), read, write)
    read=0 write=0
}
  • Remember to run eclipse with root, in Run Configurations -> User mark theExecute script as current user.

转载于:https://my.oschina.net/u/2475751/blog/527607

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值