{anchor:top}
h1. {anchor:CHP-ANON} Anonymous Tracing
This 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.
[Top|#top]
h2. {anchor:CHP-ANON-1} Anonymous Enablings
To create an anonymous enabling, use the \-A option with a [{{dtrace}}(1M)|http://docs.sun.com/doc/819-2240/dtrace-1m?a=view] 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)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] driver's configuration file, typically {{/kernel/drv/dtrace.conf}}. These properties will be read by the [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] 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)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] driver is loaded on-demand, as are any drivers that act as DTrace providers. To allow tracing during boot, the [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] driver must be loaded as early as possible. {{dtrace}} adds the necessary {{forceload}} statements to {{/etc/system}} (see [{{system}}(4)|http://docs.sun.com/doc/819-2251/system-4?a=view]) for each required DTrace provider and for [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] itself.\\
\\Thereafter, when the system boots, a message is emitted by [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] 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.
[Top|#top]
h2. {anchor:CHP-ANON-2} Claiming Anonymous State
Once 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:
{noformat}
dtrace: could not enable tracing: No anonymous tracing state
{noformat}
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.
[Top|#top]
h2. {anchor:CHP-ANON-3} Anonymous Tracing Examples
The following example shows an anonymous DTrace enabling for every probe in the [{{iprb}}(7D)|http://docs.sun.com/doc/819-2254/iprb-7d?a=view] module:
{noformat}
# dtrace -A -m iprb
dtrace: saved anonymous enabling in /kernel/drv/dtrace.conf
dtrace: added forceload directives to /etc/system
dtrace: run update_drv(1M) or reboot to enable changes
# reboot
{noformat}
After rebooting, [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] prints a message on the console to indicate that it is enabling the specified probes:
{noformat}
...
Copyright 1983-2003 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
NOTICE: enabling probe 0 (:iprb::)
NOTICE: enabling probe 1 (dtrace:::ERROR)
configuring IPv4 interfaces: iprb0.
...
{noformat}
When the machine has rebooted, the anonymous state may be consumed by specifying the \-a option with {{dtrace}}:
{noformat}
# dtrace -a
CPU ID FUNCTION:NAME
0 22954 _init:entry
0 22955 _init:return
0 22800 iprbprobe:entry
0 22934 iprb_get_dev_type:entry
0 22935 iprb_get_dev_type:return
0 22801 iprbprobe:return
0 22802 iprbattach:entry
0 22874 iprb_getprop:entry
0 22875 iprb_getprop:return
0 22934 iprb_get_dev_type:entry
0 22935 iprb_get_dev_type:return
0 22870 iprb_self_test:entry
0 22871 iprb_self_test:return
0 22958 iprb_hard_reset:entry
0 22959 iprb_hard_reset:return
0 22862 iprb_get_eeprom_size:entry
0 22826 iprb_shiftout:entry
0 22828 iprb_raiseclock:entry
0 22829 iprb_raiseclock:return
...
{noformat}
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}}.
{noformat}
fbt::iprbattach:entry
{
self->trace = 1;
}
fbt:::
/self->trace/
{}
fbt::iprbattach:return
{
self->trace = 0;
}
{noformat}
Run the following commands to clear the previous settings from the driver configuration file, install the new anonymous tracing request, and reboot:
{noformat}
# dtrace -AFs iprb.d
dtrace: cleaned up old anonymous enabling in /kernel/drv/dtrace.conf
dtrace: cleaned up forceload directives in /etc/system
dtrace: saved anonymous enabling in /kernel/drv/dtrace.conf
dtrace: added forceload directives to /etc/system
dtrace: run update_drv(1M) or reboot to enable changes
# reboot
{noformat}
After rebooting, [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] prints a different message on the console to indicate the slightly different enabling:
{noformat}
...
Copyright 1983-2003 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
NOTICE: enabling probe 0 (fbt::iprbattach:entry)
NOTICE: enabling probe 1 (fbt:::)
NOTICE: enabling probe 2 (fbt::iprbattach:return)
NOTICE: enabling probe 3 (dtrace:::ERROR)
configuring IPv4 interfaces: iprb0.
...
{noformat}
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.
{noformat}
# dtrace -ae
CPU FUNCTION
0 -> iprbattach
0 -> gld_mac_alloc
0 -> kmem_zalloc
0 -> kmem_cache_alloc
0 -> kmem_cache_alloc_debug
0 -> verify_and_copy_pattern
0 <- verify_and_copy_pattern
0 -> tsc_gethrtime
0 <- tsc_gethrtime
0 -> getpcstack
0 <- getpcstack
0 -> kmem_log_enter
0 <- kmem_log_enter
0 <- kmem_cache_alloc_debug
0 <- kmem_cache_alloc
0 <- kmem_zalloc
0 <- gld_mac_alloc
0 -> kmem_zalloc
0 -> kmem_alloc
0 -> vmem_alloc
0 -> highbit
0 <- highbit
0 -> lowbit
0 <- lowbit
0 -> vmem_xalloc
0 -> highbit
0 <- highbit
0 -> lowbit
0 <- lowbit
0 -> segkmem_alloc
0 -> segkmem_xalloc
0 -> vmem_alloc
0 -> highbit
0 <- highbit
0 -> lowbit
0 <- lowbit
0 -> vmem_seg_alloc
0 -> highbit
0 <- highbit
0 -> highbit
0 <- highbit
0 -> vmem_seg_create
...
{noformat}
{excerpt:hidden=true}Converted by tech dogg's sgml2wiki on Tue 20 Nov 2007 at 9:22:55 PM{excerpt}
h1. {anchor:CHP-ANON} Anonymous Tracing
This 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.
[Top|#top]
h2. {anchor:CHP-ANON-1} Anonymous Enablings
To create an anonymous enabling, use the \-A option with a [{{dtrace}}(1M)|http://docs.sun.com/doc/819-2240/dtrace-1m?a=view] 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)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] driver's configuration file, typically {{/kernel/drv/dtrace.conf}}. These properties will be read by the [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] 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)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] driver is loaded on-demand, as are any drivers that act as DTrace providers. To allow tracing during boot, the [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] driver must be loaded as early as possible. {{dtrace}} adds the necessary {{forceload}} statements to {{/etc/system}} (see [{{system}}(4)|http://docs.sun.com/doc/819-2251/system-4?a=view]) for each required DTrace provider and for [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] itself.\\
\\Thereafter, when the system boots, a message is emitted by [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] 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.
[Top|#top]
h2. {anchor:CHP-ANON-2} Claiming Anonymous State
Once 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:
{noformat}
dtrace: could not enable tracing: No anonymous tracing state
{noformat}
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.
[Top|#top]
h2. {anchor:CHP-ANON-3} Anonymous Tracing Examples
The following example shows an anonymous DTrace enabling for every probe in the [{{iprb}}(7D)|http://docs.sun.com/doc/819-2254/iprb-7d?a=view] module:
{noformat}
# dtrace -A -m iprb
dtrace: saved anonymous enabling in /kernel/drv/dtrace.conf
dtrace: added forceload directives to /etc/system
dtrace: run update_drv(1M) or reboot to enable changes
# reboot
{noformat}
After rebooting, [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] prints a message on the console to indicate that it is enabling the specified probes:
{noformat}
...
Copyright 1983-2003 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
NOTICE: enabling probe 0 (:iprb::)
NOTICE: enabling probe 1 (dtrace:::ERROR)
configuring IPv4 interfaces: iprb0.
...
{noformat}
When the machine has rebooted, the anonymous state may be consumed by specifying the \-a option with {{dtrace}}:
{noformat}
# dtrace -a
CPU ID FUNCTION:NAME
0 22954 _init:entry
0 22955 _init:return
0 22800 iprbprobe:entry
0 22934 iprb_get_dev_type:entry
0 22935 iprb_get_dev_type:return
0 22801 iprbprobe:return
0 22802 iprbattach:entry
0 22874 iprb_getprop:entry
0 22875 iprb_getprop:return
0 22934 iprb_get_dev_type:entry
0 22935 iprb_get_dev_type:return
0 22870 iprb_self_test:entry
0 22871 iprb_self_test:return
0 22958 iprb_hard_reset:entry
0 22959 iprb_hard_reset:return
0 22862 iprb_get_eeprom_size:entry
0 22826 iprb_shiftout:entry
0 22828 iprb_raiseclock:entry
0 22829 iprb_raiseclock:return
...
{noformat}
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}}.
{noformat}
fbt::iprbattach:entry
{
self->trace = 1;
}
fbt:::
/self->trace/
{}
fbt::iprbattach:return
{
self->trace = 0;
}
{noformat}
Run the following commands to clear the previous settings from the driver configuration file, install the new anonymous tracing request, and reboot:
{noformat}
# dtrace -AFs iprb.d
dtrace: cleaned up old anonymous enabling in /kernel/drv/dtrace.conf
dtrace: cleaned up forceload directives in /etc/system
dtrace: saved anonymous enabling in /kernel/drv/dtrace.conf
dtrace: added forceload directives to /etc/system
dtrace: run update_drv(1M) or reboot to enable changes
# reboot
{noformat}
After rebooting, [{{dtrace}}(7D)|http://docs.sun.com/doc/819-2254/dtrace-7d?a=view] prints a different message on the console to indicate the slightly different enabling:
{noformat}
...
Copyright 1983-2003 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
NOTICE: enabling probe 0 (fbt::iprbattach:entry)
NOTICE: enabling probe 1 (fbt:::)
NOTICE: enabling probe 2 (fbt::iprbattach:return)
NOTICE: enabling probe 3 (dtrace:::ERROR)
configuring IPv4 interfaces: iprb0.
...
{noformat}
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.
{noformat}
# dtrace -ae
CPU FUNCTION
0 -> iprbattach
0 -> gld_mac_alloc
0 -> kmem_zalloc
0 -> kmem_cache_alloc
0 -> kmem_cache_alloc_debug
0 -> verify_and_copy_pattern
0 <- verify_and_copy_pattern
0 -> tsc_gethrtime
0 <- tsc_gethrtime
0 -> getpcstack
0 <- getpcstack
0 -> kmem_log_enter
0 <- kmem_log_enter
0 <- kmem_cache_alloc_debug
0 <- kmem_cache_alloc
0 <- kmem_zalloc
0 <- gld_mac_alloc
0 -> kmem_zalloc
0 -> kmem_alloc
0 -> vmem_alloc
0 -> highbit
0 <- highbit
0 -> lowbit
0 <- lowbit
0 -> vmem_xalloc
0 -> highbit
0 <- highbit
0 -> lowbit
0 <- lowbit
0 -> segkmem_alloc
0 -> segkmem_xalloc
0 -> vmem_alloc
0 -> highbit
0 <- highbit
0 -> lowbit
0 <- lowbit
0 -> vmem_seg_alloc
0 -> highbit
0 <- highbit
0 -> highbit
0 <- highbit
0 -> vmem_seg_create
...
{noformat}
{excerpt:hidden=true}Converted by tech dogg's sgml2wiki on Tue 20 Nov 2007 at 9:22:55 PM{excerpt}