Objective-C: Using Instruments to trace messages-to-nil
Friday, January 4th, 2008In Leopard, Apple added a new tool to the developer tool suite called Instruments. It is a timeline based debugging and performance analysis tool. With a full suite of tools to analyze all kinds of dimensions of performance, correlating all data onto a timeline that can be inspected and navigated at will. And it remembers prior runs so you can compare results before and after changes.
And it fully consumes dtrace.
Clicking through the screenshot at right will show a run of Instruments with a single analysis instrument active.
I created a custom instrument that encapsulates the dtrace script I discussed in Objective-C: Using dtrace to trace messages-to-nil.
I ran the resulting instrument against TextEdit.
What can’t be conveyed by that screenshot is exactly how “live” the data can be examined. You can click and drag on the timeline to select a subset of the run, details of the selected instrument are shown in the table in bottom right, and any given row can be selected to show the backtrace active at the time the sample was taken.
I didn’t want to clutter up the screenshot with lots of data and, thus, didn’t demonstrate the awesomeness that is being able to relate data across multiple instruments, correlated by time.
That’ll be in the next Mac OS X / Software related post.
Click on through for an explanation with screenshots as to exactly how to convert the dtrace script to an instrument.





