Solaris Dynamic Tracing Guide

Eliminating dtrace(1M) Interference

If you trace every call to the write(2) system call, you will cause a cascade of output. Each call to write() causes the dtrace(1M) command to call write() as it displays the output, and so on. This feedback loop is a good example of how the dtrace command can interfere with the desired data. You can use a simple predicate to prevent these unwanted data from being traced:

/pid != $pid/
	printf("%s", stringof(copyin(arg1, arg2)));

The $pid macro variable expands to the process identifier of the process that enabled the probes. The pid variable contains the process identifier of the process whose thread was running on the CPU where the probe was fired. Therefore the predicate /pid != $pid/ ensures that the script does not trace any events related to the running of this script itself.