Содержащиеся вНайти другие документыРесурсы поддержки | Загрузить это руководство в формате PDF (1901 КБ)
Chapter 36 Anonymous TracingThis chapter describes anonymous tracing, tracing that is not associated with any DTrace consumer. Anonymous tracing is used in situations when no DTrace consumer processes can run. The most common use of anonymous tracing is to permit device driver developers to debug and trace activity that occurs during system boot. Any tracing that you can do interactively you can do anonymously. However, only the super user may create an anonymous enabling, and only one anonymous enabling can exist at any time. Anonymous EnablingsTo create an anonymous enabling, use the -A option with a dtrace(1M) invocation that specifies the desired probes, predicates, actions and options. dtrace will add a series of driver properties representing your request to the dtrace(7D) driver's configuration file, typically /kernel/drv/dtrace.conf. These properties will be read by the dtrace(7D) driver when it is loaded. The driver will enable the specified probes with the specified actions, and create an anonymous state to associate with the new enabling. Normally, the dtrace(7D) driver is loaded on-demand, as are any drivers that act as DTrace providers. To allow tracing during boot, the dtrace(7D) driver must be loaded as early as possible. dtrace adds the necessary forceload statements to /etc/system (see system(4)) for each required DTrace provider and for dtrace(7D) itself. Thereafter, when the system boots, a message is emitted by dtrace(7D) to indicate that the configuration file has been successfully processed. All options may be set with an anonymous enabling, including buffer size, dynamic variable size, speculation size, number of speculations, and so on. To remove an anonymous enabling, specify -A to dtrace without any probe descriptions. Claiming Anonymous StateOnce the machine has completely booted, any anonymous state may be claimed by specifying the -a option with dtrace. By default, -a claims the anonymous state, processes the existing data, and continues to run. To consume the anonymous state and then exit, add the -e option. Once anonymous state has been consumed from the kernel, it cannot be replaced: the in-kernel buffers that contained it are reused. If you attempt to claim anonymous tracing state where none exists, dtrace will generate a message similar to the following example:
If drops or errors have occurred, dtrace will generate the appropriate messages when the anonymous state is claimed. The messages for drops and errors are the same for both anonymous and non-anonymous state. Anonymous Tracing ExamplesThe following example shows an anonymous DTrace enabling for every probe in the iprb(7D) module:
After rebooting, dtrace(7D) prints a message on the console to indicate that it is enabling the specified probes:
When the machine has rebooted, the anonymous state may be consumed by specifying the -a option with dtrace:
The following example focuses only on those functions called from iprbattach(). In an editor, type the following script and save it in a file named iprb.d. fbt::iprbattach:entry
{
self->trace = 1;
}
fbt:::
/self->trace/
{}
fbt::iprbattach:return
{
self->trace = 0;
}
Run the following commands to clear the previous settings from the driver configuration file, install the new anonymous tracing request, and reboot:
After rebooting, dtrace(7D) prints a different message on the console to indicate the slightly different enabling:
After the machine has completely booted, run the dtrace with the -a option and the -e option to consume the anonymous data and then exit.
|
|||||||