Using Set Declaration Macros
The Execution Tracing package groups traceable functions into trace event sets, which provide precise control of trace output. Once the sets have been defined, trace output can be toggled on or off at the package, class, or function level, simply by defining the appropriate environment variables.
To determine if a function should generate a trace event, the Execution Tracing package uses a hierarchical lookup through the sets, as shown in
Figure 31. For example, if the environment variable mapping to a particular function is set to ON, the event is generated. If the environment variable is set to OFF, the event is not generated. If the environment variable is undefined (or defined to something else), the environment variable mapping to the class, if any, is checked. If the class environment variable is undefined, the package environment variable is checked. If it is OFF or undefined, no event is generated. Thus, coarse-grained control of trace output can be achieved by setting only the package or class environment variables to ON. Classes and global functions marked with the
RW_USER macros default to the predefined rw_user package, as in the example on
Example 49. See
Setting Environment Variables for Event Sets for information on setting environment variables.
The set declaration macros implement the run-time lookup of environment variables that determine whether a function will generate a trace event. Trace does not work correctly if the set declaration macros are not used or are used improperly. Set declaration macro names all include the word TRACEABLE, to distinguish them from event generation macros. Set declaration macros come in three varieties: package declaration macros, class declaration macros, and function declaration macros.