Dtrace on Leopard

Leopard got what's considered to be the best debugging tool in the world, dtrace, coming directly from the Open Solaris kernel. Dtrace lets you probe your kernel in an unprecedented and dynamic way (ie, without recompiling.)

Here you can find the dtrace solaris guide if you want to delve deep in its syntax and probes.

Almost everyone (myself included) blogged or wrote about the Ruby dtrace probes being in Leopard, so I immediately tried a bunch of scripts to give them a run. Interestingly, you can find dtrace ruby examples right in the /Developer directory.

<rant>That probably means a shift in Apple developer support from Java to Ruby, which sounds a bit strange if you really think about that: how cool and useful could be a java 6 JVM with a lot of dtrace probes? Yep, I like Ruby. I like it a lot for fast object oriented scripting, I like the dynamic part, I like the Smalltalkness and whatever. But, seriously, java is THE platform to support. Come on. We are all waiting for exciting java news from you, Apple. </rant>

Well, let's go back in topic now.

sudo dtrace -s /Developer/Examples/Ruby/DTrace/print_calls.d

says that

dtrace: failed to compile script /Developer/Examples/Ruby/DTrace/print_calls.d: line 4: probe description ruby*:::function-entry does not match any probes

and infact with a simple grep

sudo dtrace -l | grep -i object-free

you can see that it doesn't show one the expected ruby probes.

So, are the Ruby dtraces probe really there or the Gold Master lost something?

<update> Ok, just found this a few minutes after publishing :).

Being dynamic, you should attach it to a running ruby interpreter. Can't still explain why the dtrace -l doesn't show the ruby probes...

sudo dtrace -s /Developer/Examples/Ruby/DTrace/print_memory_usage.d -p <pid> PID number</pid>

</update>
Comments

Leopard: things I like and things I dislike, a developer perspective

It's more than a full day working on Leopard right now. So, here are my first impressions on what I like and what I don't like from a developer perspective.What I like:
  1. Time Machine. Easy, almost everyone paid lip service to TM. But it's still impressive when you look at it
  2. Dtrace and Instruments. This is a joy for developers. More on this in next posts, in the meanwhile have a look at Bryan Cantrill blog,  dtrace creator 
  3. Spaces. Another easy one. Bye bye buggy Virtue Desktop, welcome pre-organized spaces (yes, you can assign applications to predefined spaces)
  4. Terminal. You won't need anymore iTerm to tail logs in tabbed windows.
  5. Calendar icon now shows the real date and not 17 of July!
  6. Ruby/Rails out of the box. Very nice to have ruby/rails integrated. Well, I would have preferred a java 6 virtual machine, but it's nonetheless a nice feature. Not as much as the Calendar icon, but a good one :). Jokes aside, is nice that ruby apps on apple are also Dtraceable
What I don't like:
  1. No Java 6. No workarounds: but java 5 looks very fast, and rumors are that we will see java 6 very soon. (hopefully with fast opengl rendered Swing, working Java Sound and a lot of dtrace probes)
  2. PostgreSql from MacPorts failed to compile, and I still hadn't had time to see why
  3. The 3D Dock looks ugly. Easy workaround:  simply type "defaults write com.apple.dock no-glass -boolean YES" and then a "killall Dock" in the command line
  4. The tranlucent menu looks ugly too. This isn't easily and completely solved right now
  5. Skype works only the first time! This happens because Skype self-modifies itself after the first launch, and the app signing mechanism break. Either wait for Skype folks to solve it or reinstall with the firewall disabled. More info here
  6. Intellij Idea 7.0.1 can't be assigned to a space :(
Comments (1) Show Comments