Ruby User-Space Markers
Ruby-2.0.0 in Fedora 19 include the following user-space markers:
ruby.array.create ruby.cmethod.entry ruby.cmethod.return ruby.find.require.entry ruby.find.require.return ruby.gc.mark.begin ruby.gc.mark.end ruby.gc.sweep.begin ruby.gc.sweep.end ruby.hash.create ruby.load.entry ruby.load.return ruby.method.entry ruby.method.return ruby.object.create ruby.parse.begin ruby.parse.end ruby.raise ruby.require.entry ruby.require.return ruby.string.create
Some work has been done in Ruby to include support for SystemTap user-space markers in Red Hat Enterprise Linux 6.2 and allow SystemTap to probe the start and completion of each Ruby function. The Ruby user-space probes available in RHEL-6.2 are:
ruby.function.entry classname:string methodname:string file:string line:long $arg1:long $arg2:long $arg3:long $arg4:long ruby.function.return classname:string methodname:string file:string line:long $arg1:long $arg2:long $arg3:long $arg4:long ruby.gc.begin ruby.gc.end ruby.line file:string line:long $arg1:long $arg2:long ruby.object.free classname:string $arg1:long ruby.raise classname:string file:string line:long $arg1:long $arg2:long $arg3:long ruby.rescue file:string line:long $arg1:long $arg2:long ruby.ruby__probe probe_point:string probe_data:string $arg1:long $arg2:long
Using Ruby User-Space Markers
To use the Ruby user-space markers on a Fedora you will need:
- RPMs:
- ruby
- systemtap, systemtap-runtime
Membership to the appropriate unix groups (or root) to use systemtap in general. See also http://sourceware.org/systemtap/man/stap-server.8.html
Examples Scripts for Ruby Probing
Short example scripts:
"top" for Ruby, rubyfuntop.stp
tracing Ruby function calls, ruby-example.stp
counting method calls: http://lukas.zapletalovi.com/2012/01/probing-ruby-apps-with-systemtap-in.html
The SystemTap Ruby user-space probes provide similar functionality to the probe points used in:
http://tenderlovemaking.com/2011/12/05/profiling-rails-startup-with-dtrace/