DTrace, also known as Dynamic Tracing, was developed by Sun™ as a tool for locating performance bottlenecks in production and pre-production systems. In addition to diagnosing performance problems, DTrace can be used to help investigate and debug unexpected behavior in both the FreeBSD kernel and in userland programs.
DTrace is a remarkable profiling tool, with an impressive array of features for diagnosing system issues. It may also be used to run pre-written scripts to take advantage of its capabilities. Users can author their own utilities using the DTrace D Language, allowing them to customize their profiling based on specific needs.
The FreeBSD implementation provides full support for kernel
      DTrace and experimental support for userland DTrace.
      Userland DTrace allows users to perform function boundary
      tracing for userland programs using the pid
      provider, and to insert static probes into userland programs for
      later tracing.  Some ports, such as
      databases/postgresql12-server and
      lang/php74 have a DTrace option to enable
      static probes.
The official guide to DTrace is maintained by the Illumos
      project at DTrace
	Guide.
After reading this chapter, you will know:
What DTrace is and what features it provides.
Differences between the Solaris™ DTrace implementation and the one provided by FreeBSD.
How to enable and use DTrace on FreeBSD.
Before reading this chapter, you should:
Understand UNIX® and FreeBSD basics (Chapter 3, FreeBSD Basics).
Have some familiarity with security and how it pertains to FreeBSD (Chapter 13, Security).
All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/
Questions that are not answered by the
    documentation may be
    sent to <freebsd-questions@FreeBSD.org>.
    Send questions about this document to <freebsd-doc@FreeBSD.org>.