O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Actions

Actions are the lines of code you write that execute whenever a probe is fired. You can assign values to variables, perform computations, and aggregate values over time.

D has no flow control, so there are no if statements and no loops. You can simulate if statements by using predicates, discussed below. The ternary operator (?:) is available, too.

The lack of loops is understandable. DTrace scripts, after they are compiled and verified, are run inside of the kernel. It would be a bad thing to have an unintentional infinite loop occur, locking up the system.

Variables

What is a programming language without variables? D has a number of kinds of variables. Simple (scalar) variables are familiar to those of us used to C, along with structures, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required