2. Types, Operators, and Expressions
8. Type and Constant Definitions
34. Statically Defined Tracing for User Applications
As shown in our examples so far, a D program source file consists of one or more probe clauses that describe the instrumentation to be enabled by DTrace. Each probe clause has the general form:
probe descriptions / predicate / { action statements }The predicate and list of action statements may be omitted. Any directives found outside probe clauses are referred to as declarations. Declarations may only be used outside of probe clauses. No declarations inside of the enclosing { } are permitted and declarations may not be interspersed between the elements of the probe clause shown above. Whitespace can be used to separate any D program elements and to indent action statements.
Declarations can be used to declare D variables and external C symbols as discussed in Chapter 3, Variables, or to define new types for use in D, as described in Chapter 8, Type and Constant Definitions. Special D compiler directives called pragmas may also appear anywhere in a D program, including outside of probe clauses. D pragmas are specified on lines beginning with a # character. D pragmas are used, for example, to set run-time DTrace options; see Chapter 16, Options and Tunables for details.