Declaring Probes

The sdt probes are declared by using the DTRACE_PROBE macro from <linux/sdt.h>.

The module name and function name of an SDT-based probe correspond to the kernel module and function of the probe, respectively. 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. Use the dtrace -l -m module command to list the probes that your driver module has installed and the full names that are seen by DTrace users.

The name of the probe depends on the name that is provided in the DTRACE_PROBE macro. If the name does not contain two consecutive underscores (__), the name of the probe is as written in the macro. If the name contains two consecutive underscores, the probe name converts the consecutive underscores to a single dash (-). For example, if a DTRACE_PROBE macro specifies transaction__start, the SDT probe is named transaction-start. This substitution enables C code to provide macro names that are not valid C identifiers without specifying a string.

SDT can also act as a metaprovider by registering probes so that they appear to come from other providers, such as io, proc, and sched, which do not have dedicated modules of their own. For example, kernel/exit.c contains calls to the DTRACE_PROC macro, which are defined as follows in <linux/sdt.h>:

# define DTRACE_PROC(name) \

Probes that use such macros appear to come from a provider other than sdt. The leading double underscore, provider name, and trailing underscore in the name argument are used to match the provider and are not included in the probe name. Note that the functionality for creating probes for providers other than those that are hard-coded into DTrace is not currently available.