Install systemtap on Ubuntu 14.04

What is systemtap?

There are several articles can answer this question:html

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-INSTALLweb

  • 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. ubuntu

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

  1. Build from kernel source jsp

  • Download kernel source from kernel.org ide

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

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

  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.

相關文章
相關標籤/搜索