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:
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.