A Quick Look at DTrace
Recently I heard about a technology called DTrace. What's it all about?
DTrace is a low-level instrumentation technology which found its way to the Mac some years ago. Basically, DTrace - short for dynamic tracing - is for the kernel like a thermometer for your steak: Every once in a while, you stick it inside the delicious thing called OS X and it let's you take a peek at what's going on inside. Only that it's always present, and it has various hooks into the system. DTrace can be programmed using the (not so) famous D language. Actually, Apples Developer tool Instruments uses DTrace, too. Outside of Instruments, you can make use of D scripts in Terminal by executing
Beware the spelling, by the way: DTrace is the technology, Dtrace is the implementation (i.e. the command line tool). For the most complete info about DTrace, see Brendan Gregg's blog and his awesome DTrace book.
Now to the good part: OS X comes ready with a bunch of DTrace scripts, easily discernible by the extension ".d":