DTRACE_PROFILE(4)
π« DTRACE_PROFILE(4) π«
okay so real talk β this is a page from the Kernel Interfaces Manual, and it's all about dtrace_profile, a DTrace provider that fires probes at a given time interval. bestie, it's literally a metronome for your kernel. β¨
πΈ NAME πΈ
dtrace_profile β a DTrace provider for firing probes at a given time interval. that's it, that's the vibe. π
π¦ SYNOPSIS π¦
profile:::profile-rate[unit]
profile:::tick-rate[unit]
π DESCRIPTION π
The profile provider implements three special probes related to the life cycle of the DTrace program itself. yes, three. no cap.
β¨ Probes β¨
profile:::profileβ these probes fire on all CPUs and are suitable for measuring the whole system periodically. like, the entire system. main character energy for your whole machine. πprofile:::tickβ these probes fire on a single CPU, and potentially a different one every single time (chaotic, honestly). super useful, e.g., for printing partial results periodically. π°οΈ
π Rate and Time Units π
The profile provider probes will fire at the specified rate. simple as that.
The default unit is hz. the profile provider supports the following time units:
ns,nsecβ nanosecondsus,usecβ microsecondsms,msecβ millisecondss,secβ secondsm,minβ minutesh,hourβ hoursd,dayβ dayshzβ Hertz (frequency per second)
π«Ά Probe Arguments π«Ά
The arguments of the profile provider probes are:
arg0β the PC (program counter) in the kernel when the probe triggered, or0if the process was not in the kernel at that time.arg1β the PC in the user process when the probe triggered, or0if the process was in the kernel when the probe triggered.
Use arguments arg0 and arg1 to tell if the profile provider probe fired in the kernel or in the userspace context. it's giving "which world are we in rn" π
π₯ IMPLEMENTATION NOTES π₯
The sysctl(8) variable kern.dtrace.profile.aframes controls the number of skipped artificial frames for the profile provider. noted. filed away. π
π EXAMPLES π
β Example 1: Profiling On-CPU Kernel Stack Traces β
The following DTrace one-liner uses the profile provider to collect stack traces over 60 seconds. iconic behavior honestly.
dtrace -x stackframes=100 -n 'profile-197 /arg0/ {@[stack()] = count();} tick-60s {exit(0);}
The system is profiled at the 197 Hz to avoid sampling in lockstep with other periodic activities. this unnatural frequency minimizes the chance of overlapping with other events β like, it's deliberately weird on purpose, iykyk. π§
Option -x stackframes=100 increases the maximum number of kernel stack frames to unwind during stack().
Checking if arg0 is not zero makes sure that profiling happens when the program is in the kernel context.
Refer to https://www.brendangregg.com/flamegraphs.html to learn about generating flame graphs from the obtained stack traces. π₯ (literally flame graphs, the name is not a drill)
π SEE ALSO π
The illumos Dynamic Tracing Guide, https://www.illumos.org/books/dtrace/chp-profile.html, 2008, Chapter profile Provider.
Brendan Gregg and Jim Mauro, DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD, Prentice Hall, https://www.brendangregg.com/dtracebook/, pp. 24β25, 2011.
πΈ AUTHORS πΈ
This manual page was written by Mateusz Piotrowski <0mp@FreeBSD.org>. thank you mateusz, you ate. π«Ά
okay that's the whole page bestie, you're now officially a profile-provider knower. go forth and sample responsibly. π¦π
big slay sign-off: this came from the fine folks over at Debian, dated July 14, 2025 β periodt. π β¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- π the page's license: BSD-2-Clause
- Copyright (c) 2025 Mateusz Piotrowski <0mp@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms