How do I install DTrace?

Solution 1:

1

I found the sytemtap-sdt-dev package. From a terminal type:

sudo apt-get install systemtap-sdt-dev

This package provides dtrace.

Please note that although it's named dtrace for a reason, it's not exactly the same as the original from Solaris. You can probably do some stuff, but not all.

2

If you don't mind compiling, a more feature-complete version of dtrace is the port by Paul Fox:
ftp://crisp.dyndns-server.com/pub/release/website/dtrace/

It's pretty easy to build, see README.

3

There's also an Oracle port. But I haven't tested it and wouldn't recommend it. Apparently, it only has about 0,1 percent of the probes the Paul Fox port.

$ dtrace -l | wc -l
394267

Which is ironic, because Oracle purchased Sun, the original authors of dtrace for Solaris.

4

Note that Linux-dtrace lacks some userspace functionality that the (original) Solaris-dtrace provides. So certain uses for dtrace, such as profiling Node.js, will be complicated, if not impossible, using either clone, fork or immitation of dtrace.

Solution 2:

Use git or download several versions of dtrace here. I found these Installation instructions:

git clone "https://github.com/dtrace4linux/linux.git" dtrace
cd dtrace
tools/get-deps.pl
make all 
make install
sudo make load

Sidenote: A comment on brainstorm claims you could do the same with these 3:

  • pTrace
  • uTrace
  • systemtap Install systemtap