Functions

D provides a number of functions you can use in your action scripts. Here is a sampling.

printf

Standard C-style printf function

trace

Displays its argument, using a default format based on the type. Also appends a newline for you.

printa

Print aggregate values, described in more detail below.

ustack

Print the user level stack trace. If the process exits or is killed before the DTrace experiment has completed, DTrace might not be able to resolve the program counter, so you will get hex values rather than symbolic values.

exit

Terminate execution early. Otherwise, you have to type Control-C to quit.

copyin, copyinstr

DTrace scripts execute in kernel scope. Consider probing a system call like write(), which takes a pointer to a buffer with ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.