ring Policy

The DTrace ring buffer policy helps you trace the events leading up to a failure. If reproducing the failure takes hours or days, you might want to keep only the most recent data. Once a principal buffer has filled, tracing wraps around to the first entry, thereby overwriting older tracing data. You establish the ring buffer by setting the bufpolicy option to the string ring:

# dtrace -s foo.d -x bufpolicy=ring

When used to create a ring buffer, dtrace will not display any output until the process is terminated. At that time, the ring buffer is consumed and processed. dtrace processes each ring buffer in CPU order. Within a CPU's buffer, trace records are displayed in order from oldest to youngest. Just as with the switch buffering policy, no ordering exists between records from different CPUs. If such an ordering is required, you must trace the timestamp variable as part of your tracing request.

The following example demonstrates the use of a #pragma D option directive to enable ring buffering:

#pragma D option bufpolicy=ring
#pragma D option bufsize=16k

syscall:::entry
/execname == $1/
{
        trace(timestamp);
}

syscall::rexit:entry
{
        exit(0);
}