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. The printa
action is therefore often used in the END probe. The BEGIN and END probes can be used together to measure the total time spent tracing:
BEGIN
{
start = timestamp;
}
/*
* ... other tracing actions...
*/
END
{
printf("total time: %d secs", (timestamp - start) / 1000000000);
}
See Data Normalization and
printa
for other common uses of the END probe.
As with the BEGIN probe, no arguments are defined for the END probe. The context in which the END probe fires is arbitrary and should not be depended upon.
When tracing with the bufpolicy option set to fill, adequate space is reserved to accommodate any records traced in the END probe. See
fill Policy and END Probes for details.
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. During this delay, no probes will fire. 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 statusrate option. For more information, see Chapter 16, Options and Tunables.