END Probe

The END probe fires after all other probes. This probe will not fire until all other probe clauses have completed. This probe can be used to process state that has been gathered or to format the output. Therefore, the END probe often uses the printa action. You can use the BEGIN and END probes together to measure the total time spent in tracing.

BEGIN
{
        start = timestamp;
}

/*
 * ... other tracing actions...
 */

END
{
        printf("total time: %d secs", (timestamp - start) / 1000000000);
}

For information about other uses of the END probe, see Data Normalization and printa Action.

No arguments are defined for the END probe. The context in which the END probe fires is arbitrary.

When tracing with the bufpolicy option set to fill, adequate space is reserved to accommodate any records traced in the END probe. For more information, see fill Policy and END Probes.

Note:

The exit action causes tracing to stop and the END probe to fire. However, there is some delay between the invocation of the exit action and the END probe firing. No probes fire during this delay. After a probe invokes the exit action, the END probe is not fired until the DTrace consumer determines that exit has been called and stops tracing. The rate at which the exit status is checked can be set using the statusrate option. For more information, see DTrace Options and Tunables.