In previous posts we’ve mentioned we’re working on a full Ruby DTrace provider set for Ruby 1.8.5. We’ve finished a solid base set of probes and it is ready for general consumption.
The subversion repository is at http://svn.joyent.com/ruby-dtrace.
The repository contains:
- The full Ruby 1.8.5 source with DTrace probes (http://svn.joyent.com/ruby-dtrace/ruby-1.8.5)
- Diffs (http://svn.joyent.com/ruby-dtrace/patches)
- Binaries (http://svn.joyent.com/ruby-dtrace/binaries/solaris)
- Examples (http://svn.joyent.com/ruby-dtrace/examples)
There are 3 binaries for Solaris provided here:
- ruby-x86: Standard GCC build
- ruby-CSK: Coolstack compliant build intended to drop into Coolstack 1.1
- ruby-CSW: Blastwave drop-in binary
The warning regarding the ruby-CSW binary is that it breaks with Blastwave tradition of using Sun Studio. Instead, GCC (/usr sfw) was used, due to various build issues with Ruby 1.8.5 and Sun Studio that are not related to the DTrace patch. The build name has been changed to Solaris 2.8 to ensure that extensions continue to work. You’re better off using the csw binary for debugging only until we can get a fully compliant build (coming real real soon).
The probes that are currently in Ruby-DTrace
Probe name Description
function-entry Probe that fires when a Ruby method is entered.
function-return Probe that fires when a Ruby method returns.
raise Probe that fires when a Ruby exception is raised.
rescue Probe that fires when a Ruby exception is rescued.
line Probe that fires for every line of Ruby executed.
gc-begin Probe that fires right before a GC cycle begins.
gc-end Probe that fires right after a GC cycle finishes.
object-create-start Probe that fires directly before a Ruby object is allocated.
object-create-done Probe that fires when Ruby is finished allocating an object
object-free Probe that fires every time a Ruby object is freed.
ruby-probe Probe that can be fired from Ruby code (see below).
Probe args args args args
function-entry Ruby class Method name Source file Line number
function-return Ruby class Method name Source file Line number
raise Ruby class Source file Line number -
rescue Source file Line number - -
line Source file Line number - -
gc-begin - - - -
gc-end - - - -
object-create-start Ruby type Source file Line number -
object-create-done Ruby type Source file Line number -
object-free Ruby type - - -
ruby-probe Arbitrary string - - -
Ruby Tracer Module
Included with the patch is a built-in Ruby module called Tracer. Tracer provides one method, Tracer.fire(str), which will fire the ruby-probe, setting
args to the string you pass in.
We will continue to add and refine probes, will be blogging about some more examples, and we are accepting requests for additional probe points (just email jason at joyent dot com). We will be developing patches against 1.8.6 in the near future.
7 responses to “DTrace for Ruby is available”
nice work scott
Wow, that’s cool. Worth running Solaris (even if inside a vm) just for profiling Ruby/Rails apps. Thanks!
For the love of all that is holy, please get this to work on Leopard.
> For the love of all that is holy, please get this to work on Leopard.
Stay tuned 🙂
Nice work guys, keep it up.
Is it me or are the binaries available above only for Solaris x86. I’m running Solaris 10 (SPARC) with the CoolStack 1.1 version of Ruby but this does not appear to have any DTrace probes in it.
I tried downloading the ruby-CSK binary above but like I said, it appears to be an x86 file.
Is a SPARC binary for ruby-CSK available?