Saturday, December 05, 2009

DTrace on Linux.

(After I posted this article, many people seem to visit this, which is more than what I expected. I will be happy to hear what brings you here and why you are interested in this article, if you have some time to lose.)

1. Installation of DTrace on Linux (x86)

This is a Linux environment easy to set up for one's trial with DTrace:

- Ubuntu 9.10 (2.6.31-generic)

This is a short but quite precise list of steps for installation.

A. Go to ftp://crisp.dynalias.com/pub/release/website/dtrace/ to download dtrace-20091010.tar.bz2

B. Prepare utilities such as bison, flex, zlib, and libelf.

$ bunzip2 < dtrace-20091010.tar.bz2 | tar xvf -
$ sudo apt-get install bison
$ sudo apt-get install flex
$ sudo apt-get install zlib1g-dev
$ sudo apt-get install libelf-dev
$ cd dtrace-20091010
$ make all
$ sudo make install
$ sudo make load


C. Remarks

At first, I tried to install DTrace on Ubuntu 8.04 (Kernel Version 2.6.24), but in vain. The critical issue was a kernel symbol pid_task is not exported in the kernel version. The symbol is referred by the dtrace driver. The symbol seems to be exported after the kernel version 2.6.25. There were a few more issues but they were able to be easily fixed.

For my Dtrace trial, I used VMWare on iMac. The use of VMWare doesn't bother one's trial with DTrace.

Unfortunately, I couldn't find any notices from Internet on a port of DTrace on ARM. A document available in the dtrace package that I downloaded says it only supports AMD, Solaris, and X86. But I heard that iPhone OS does provide an Apple version of DTrace. iPhone 3GS is based on ARM Cortex-A8.

2. Starting DTrace

When the installed DTrace was tested according to the following tutorial, I met system hangs quite frequently.

http://wikis.sun.com/display/DTrace/Introduction

Amit Saha once made a post about this system hang, and found out the reason: it is due to gnome-terminal, xterm, and ETerm. He suggested to use KDE konsole.

http://amitksaha.blogspot.com/2009/03/dtrace-on-linux.html

So, I did:

$ sudo apt-get install konsole

If I try DTrace on konsole, the system hang problem happens far less frequently. At least I was able to run all DTrace scripts in the tutorial without system hangs.

3. Final Remark

Please refer the following link to get to know the up-to-date status of DTrace
http://crtags.blogspot.com/

3 comments:

Anonymous said...

Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

lazyswamp said...
This comment has been removed by the author.
satish said...

Hi This is Satish, Iam not able to get source code from FTP site mentioned in the blog.
Can you please provide me the link, to get source code for DTrace on Linux.
Thank you in advance

Regards
Satish.G