Probe Clauses and Declarations

A D program source file consists of one or more probe clauses that describe the instrumentation that must be enabled by DTrace. Each probe clause has the following general form:

probe descriptions
/ predicate /
{
        action statements
}

You can omit the predicate and list of action statements. Any directives found outside probe clauses are referred to as declarations. Declarations must be made 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 in the preceding example. You can use whitespace to separate any D program elements and to indent action statements.

You can use declarations to declare D variables and external C symbols. For more information, see Variables in DTrace. You can use declarations to define types in D. For more information, see Type and Constant Definitions in DTrace. 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. For example, D pragmas are used to set run-time DTrace options. For more information, see DTrace Options and Tunables.