10.2 Modifying Options

You can set options in a D script by using #pragma D followed by the string option and the option name. If the option takes a value, the option name should be followed by an equal sign (=) and the option value. The following are examples of valid option settings:

#pragma D option nspec=4

#pragma D option bufsize=2g

#pragma D option switchrate=10hz

#pragma D option aggrate=100us

#pragma D option bufresize=manual

The dtrace command also accepts option settings on the command line as an argument to the -x option, for example:

# dtrace -x nspec=4 -x bufsize=2g \
-x switchrate=10hz -x aggrate=100us -x bufresize=manual

If an invalid option is specified, dtrace indicates that the option name is invalid and exits, as shown in the following example:

# dtrace -x wombats=25
dtrace: failed to set option -x wombats: Invalid option name

Similarly, if a value is not valid for the given option, dtrace indicates that the value is invalid, as shown here:

# dtrace -x bufsize=100wombats
dtrace: failed to set option -x bufsize: Invalid value for specified option

If an option is set more than once, subsequent settings overwrite earlier settings. Some options can only be set. The presence of such an option sets it, and you cannot subsequently unset it.