13.2.2 Loading DTrace Kernel Modules

Use the modprobe command to load the modules that support the DTrace probes that you want to use. For example, if you wanted to use the probes that the proc provider publishes, you would load the sdt module.

# modprobe sdt
Note

The fasttrap, profile, sdt, and systrace modules automatically load the dtrace module, and the dtrace module automatically loads the ctf module.

To list the probes that a specific provider publishes, use the following command:

# dtrace -l -P provider

To verify that a probe is available:

# dtrace -l -n probe_name

To display the probes that are available for a specific module:

# dtrace -l -m module_name

For example, display the probes that are provided by the libphp5.so and mysqld modules for DTrace-enabled PHP and MySQL:

# dtrace -l -m libphp5.so -m mysqld
   ID   PROVIDER        MODULE                          FUNCTION NAME
    4    php3566    libphp5.so               dtrace_compile_file compile-file-entry
    5    php3566    libphp5.so               dtrace_compile_file compile-file-return
    6    php3566    libphp5.so                        zend_error error
    7    php3566    libphp5.so  ZEND_CATCH_SPEC_CONST_CV_HANDLER exception-caught
    8    php3566    libphp5.so     zend_throw_exception_internal exception-thrown
    9    php3566    libphp5.so                 dtrace_execute_ex execute-entry
   10    php3566    libphp5.so           dtrace_execute_internal execute-entry
   11    php3566    libphp5.so                 dtrace_execute_ex execute-return
   12    php3566    libphp5.so           dtrace_execute_internal execute-return
   13    php3566    libphp5.so                 dtrace_execute_ex function-entry
   14    php3566    libphp5.so                 dtrace_execute_ex function-return
   15    php3566    libphp5.so              php_request_shutdown request-shutdown
   16    php3566    libphp5.so               php_request_startup request-startup
...
  121  mysql3684        mysqld _Z16dispatch_command19enum_server_commandP3THDPcj 
                                                                 command-done
  122  mysql3684        mysqld _Z16dispatch_command19enum_server_commandP3THDPcj
                                                                 command-start
  123  mysql3684        mysqld        _Z16close_connectionP3THDj connection-done
  124  mysql3684        mysqld   _Z22thd_prepare_connectionP3THD connection-start
  125  mysql3684        mysqld    _Z21mysql_execute_commandP3THD delete-done
  126  mysql3684        mysqld    _ZN7handler13ha_delete_rowEPKh delete-row-done
  127  mysql3684        mysqld    _ZN7handler13ha_delete_rowEPKh delete-row-start
  128  mysql3684        mysqld    _Z21mysql_execute_commandP3THD delete-start
  129  mysql3684        mysqld _Z8filesortP3THDP5TABLEP8FilesortbPyS5_ 
                                                                 filesort-done
  130  mysql3684        mysqld _Z8filesortP3THDP5TABLEP8FilesortbPyS5_
                                                                 filesort-start
...
Note

For DTrace-enabled, user-space programs, this command requires the fasttrap module to have been loaded before the program was started, and it does not return any probes if no instance of the program is running. dtrace appends the PID of the process to the DTrace provider name that was defined for the program when it was built.