DTrace and Instruments
- DTrace is a scriptable application/system tracing facility.
- The D scripting language is an AWK/C mashup, using:
- C (and cpp) syntax
- AWK's pattern-action paradigm
- Each D probe is defined by a four-part pattern:
- Provider (e.g., dtrace, syscall)
- Module (e.g., genunix)
- Function (e.g., chmod, close)
- Name (e.g., BEGIN, END, entry, return)
- Instruments is a DTrace/GarageBand mashup:
- Instruments is part of Mac OS X Leopard.
- Each instrument is coded as a D script.
- A fancy GUI allows panning, zooming, and drilling down.
- DTrace has providers for Java, JavaScript, Python, and Ruby.
Examples:
/* Print "hello, world" on dtrace(1) startup. */
dtrace:::BEGIN
{
trace("hello, world");
exit(0);
}
Links:
Sparks
|