NAME
tracing – introduction to FreeBSD tracing and performance monitoring
DESCRIPTION
FreeBSD features a large variety of tracing and performance monitoring facilities. Use them to measure performance and troubleshoot kernel and userland problems both during development(7) and potentially on production systems. The facilities differ in scope, ease of use, overhead, design, and limitations.
DTrace
dtrace(1) is the most versatile tracing framework available on FreeBSD and is capable of tracing throughout the FreeBSD software stack from the kernel to the applications running in userland. Refer to dtrace(1) and SDT(9) for more details.
dwatch(1) is a user-friendly wrapper for DTrace. It simplifies common DTrace usage patterns and requires less expert knowledge to operate.
Userland Tracing
truss(1) traces system calls. It uses sysdecode(3) to pretty-print system call arguments and ptrace(2) to trace processes.
ktrace(1) is useful for debugging user programs. It enables kernel trace logging for specified processes. Like truss(1), it mainly traces system calls, but instead of using ptrace(2), it asynchronously logs entries to a trace file configured with ktrace(2) (typically ktrace.out), and it can log other types of kernel events, such as page faults and name lookups (refer to -t in ktrace(1)). Also, programs can log to a ktrace(1) stream using the utrace(2) system call.
Kernel Tracing
ktr(4) is a facility for logging strings in the kernel. It comes in handy for some niche purposes during kernel development. It lets kernel programmers log events to a global ring buffer, which can later be dumped using ktrdump(8).
Hardware-Accelerated Tracing
hwt(4) is a kernel trace framework providing infrastructure for hardware-assisted tracing.
Hardware Counters
pmcstat(8), and its kernel counterpart, hwpmc(4), is the FreeBSD facility for conducting performance measurements with hardware counters.
Boot-Time And Shutdown Tracing
boottrace(4) is a facility for tracing events at boot and shutdown. Its target audience are system administrators.
tslog(4) is a developer-oriented tool for tracing boot-time events.
HISTORY
The tracing manual page was written by Mateusz Piotrowski ⟨[email protected]⟩. It first appeared in FreeBSD 15.0.