22

Googling suggests that DTrace is available on Linux but I can't find instructions as how to install it.

DTrace is a comprehensive dynamic tracing framework. It is designed to give operational insights that allow users to tune and troubleshoot applications and the OS itself. Special consideration has been taken to make it safe to use in a production environment. For example, there is minimal probe effect when tracing is underway, and no performance impact associated with any disabled probe; this is important since there are tens of thousands of DTrace probes that can be enabled.

2 Answers 2

19

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.

1
  • 5
    Indeed, the version in "systemtap-sdt-dev" does not support the "-n" option Commented Mar 12, 2014 at 18:39
15

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:

5
  • interesting question - this weblink says that dtrace is not available for "debian" (aka ubuntu?) - its more up-to-date than your linked instruction. webcache.googleusercontent.com/…
    – fossfreedom
    Commented Sep 11, 2011 at 13:10
  • See the last comment on brainstorm here: brainstorm.ubuntu.com/idea/4971 No deb but it is useable on Ubuntu.
    – Rinzwind
    Commented Sep 11, 2011 at 13:13
  • ok - hopefully the OP will test this out - +1 from me.
    – fossfreedom
    Commented Sep 11, 2011 at 13:14
  • I also found this one brainstorm.ubuntu.com/idea/11463 ptrace, utrace and systemtap edited in as an alternative (did not try these too btw ;) )
    – Rinzwind
    Commented Sep 11, 2011 at 13:26
  • . build/config.sh ; \ mkdir -p ""/usr/lib/dtrace/$CPU_BITS ; \ rm -f ""/usr/lib/dtrace/types.d ; \ mkdir -p ""/usr/sbin/ ; \ install -m 4755 -o root build/dtrace ""/usr/sbin/dtrace ; \ install -m 644 -o root build/drti.o ""/usr/lib/dtrace/$CPU_BITS/drti.o mkdir: cannot create directory '/usr/lib/dtrace': Permission denied install: cannot create regular file '/usr/sbin/dtrace': Permission denied install: cannot create regular file '/usr/lib/dtrace/64/drti.o': No such file or directory makefile:110: recipe for target 'install' failed make: *** [install] Error 1
    – gtzinos
    Commented Oct 6, 2018 at 13:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .