I like dtrace. I also like Linux. And thats where the problems begin: there is no proper dtrace for Linux. However, systemtap exists. systemtap is compatible to dtrace probes, however, it comes with it's own scripting language.
For those who don't know what any of these are: both are tools to efficiently trace programs at runtime, with a very low overhead. To allow that, they use so-called "probes" compiled into the program. Your kernel is usually equipped with such probes and Ruby 2.0 or higher also comes with quite a few of them.
However, the whole process is a bit involved and I found no good explanation for the whole setup and the pitfalls. Read on for my attempt. I will use Ubuntu as an example system.