DTrace on FreeBSD

This page contains a quick-start guide to DTrace and links to useful examples of how to use DTrace to instrument your kernel for performance or functional analysis.

Quick-start guide

  1. Compile KDTRACE_HOOKS, DDB_CTF, and for amd64 KDTRACE_FRAME, into your kernel:

options KDTRACE_HOOKS        # all architectures - enable general DTrace hooks
options DDB_CTF              # all architectures - kernel ELF linker loads CTF data
options KDTRACE_FRAME        # amd64-only
  1. Recompile your kernel using WITH_CTF=1 on the command line; note: this will not work in make.conf or src.conf, it must be on the buildkernel or make command line. You will need to specify it every time you rebuild your kernel (for now):

make buildkernel KERNCONF=DTRACE WITH_CTF=1
  1. Install new kernel and reboot:

make installkernel KERNCONF=DTRACE
shutdown -r NOW
  1. Load some or all DTrace kernel modules

kldload dtraceall
  1. Confirm that you have piles of available DTrace hooks:

dtrace -l | head

You'll need to su to root in order to use DTrace, which may be fixed once we add a more comprehensive fine-grained privilege policy.

Links

DTrace (last edited 2009-08-15 11:41:09 by MariusNuennerich)