Random Leftovers
The C preprocessor
DTrace can run your script through the C preprocessor before the code is compiled. You can use all of the standard preprocessor features to make macros with common code and include C header files to include type definitions of library types. The D compiler automatically loads the set of C type descriptions for the kernel.
Pragmas
DTrace has a number of tunable parameters you can change via pragmas. Some useful ones:
- #pragma D option quiet
same as passing -q on the command-line
- #pragma D option flowindent
dtrace prints the name of the function if an action is empty. If you turn on this pragma, DTrace will indent function call names based on call depth, giving you a call trace.
Example 9.14 is a script that traces ...
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.