dtrace_stop() Function

In Embedding DTrace in a Consumer, the consumer exits the loop and stops the data consumption but continues to generate data. The call to the dtrace_stop() function communicates to the kernel that this consumer no longer consumes data. The kernel disables any enabled probe and frees the memory for the buffers associated with this DTrace handle.

int dtrace_stop(dtrace_hdl_t *dtp)

If the consumer does not call the dtrace_stop() function, the kernel eventually performs the cleanup. The data gathering stops either when the deadman timer fires or when the DTrace device is closed. The buffers are freed when the device closes. The DTrace device closes either when the consumer calls the dtrace_close() function or when the consumer exits. It is best practice is for the consumer to call the dtrace_stop() function.