Declaring sdt
Probes
SDT probes are declared using the DTRACE_PROBE
, DTRACE_PROBE1
, DTRACE_PROBE2
, DTRACE_PROBE3
and DTRACE_PROBE4
macros from <sys/sdt.h>
. The module name and function name of an SDT-based probe corresponds to the kernel module and function of the probe. The name of the probe depends on the name given in the DTRACE_PROBEn
macro. If the name contains no two consecutive underbars (_
), the name of the probe is as written in the macro. If the name contains any two consecutive underbars, the probe name converts the consecutive underbars to a single dash (-). For example, if a DTRACE_PROBE
macro specifies transaction_start
, the SDT probe will be named transaction-start
. This substitution allows C code to provide macro names that are not valid C identifiers without specifying a string.
DTrace includes the kernel module name and function name as part of the tuple identifying a probe, so you do not need to include this information in the probe name to prevent name space collisions. You can use the command dtrace -l -P sdt -m
module on your driver module to list the probes you have installed and the full names that will be seen by users of DTrace.