[MacRuby-devel] dtrace and macruby

Scott Thompson easco at mac.com
Thu Dec 17 12:21:21 PST 2009


I'm trying to learn a bit more about dtrace and I thought that using it to add probes to macruby would be fun.

I pulled up the sample dtrace scripts from the Macruby 0.5 b2 source and was working with the script:

class World
  def say(message)
    puts message
  end
end

world = World.new
world.say('hello')
(taken from http://redartisan.com/2008/5/18/dtrace-ruby)

I tried to run the trace as:

$ sudo dtrace -s methods_count.d -c "macruby world.rb"

(where methods_count.d is one of the sample dtrace scripts)

This doesn't produce any meaningful results.

After playing around for a bit, I have learned that if I add a bit to the end of my ruby script:

while(true)
	sleep 1
end

What I take from that is if the ruby script runs for a longer time, dtrace has a chance plugging into the ruby application which it does not have when the script exits quickly.

Am I doing something the wrong way?  Is there a better way to ask dtrace to attach to my ruby application and catch information?

Scott

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20091217/78b6c9eb/attachment.html>


More information about the MacRuby-devel mailing list