BOOTTRACE(4)
π BOOTTRACE(4) β Kernel Interfaces Manual π
okay bestie, welcome to BOOTTRACE(4) from the Kernel Interfaces Manual β this one is all about tracing what your system is doing at boot, at run time, and at shutdown. π
πΈ NAME πΈ
boottrace β the Boot-time, run-time, and shutdown-time tracing facility. iconic behavior honestly π¦
β¨ SYNOPSIS β¨
#include <sys/boottrace.h>
π«Ά DESCRIPTION π«Ά
So, boottrace is a kernel-userspace interface for capturing trace events during system boot and shutdown (especially one-shot events). no cap, it's giving observability π
Event annotations are present in:
- the boot and shutdown paths in the kernel
- some key system utilities (
init(8),shutdown(8),reboot(8)) rc(8)scripts
boottrace is unconditionally compiled into the kernel and disabled by default. periodt.
π EVENT TABLES π
Events are stored in three event tables: boot-time events, run-time events, and shutdown-time events. three little tables, three whole vibes, iykyk π
- boot-time events β Boot, kernel initialization, and
rc(8)execution; untilinit(8)transitions into multi-user mode. - run-time events β From when the system has completed booting (including
rc(8)execution) andinit(8)transitions to multi-user mode until the beginning of shutdown procedures. - shutdown-time events β After initialization of a shutdown, a reboot, or a kernel panic.
π§ LOADER TUNABLES π§
Tunables can be set at the loader(8) prompt before booting the kernel or stored in loader.conf(5). boottrace features the following loader tunables:
kern.boottrace.dotrace_kernelβ Set to1to enable tracing of kernel events. Default:1(enabled). bestie, it's on by default β¨kern.boottrace.dotrace_userβ Set to1to enable tracing of userspace events. Default:1(enabled). also on by default π
π SYSCTL VARIABLES π
The following variables are available as both sysctl(8) variables and loader(8) tunables:
kern.boottrace.boottraceβ Create a new trace event and write it to the boot-time table.
A new trace event consists of a process name and an event description, separated by a colon (:). If the colon is missing or if the provided string for the process name is empty, the process name is inferred from the invoking process (which is its executable name). π«Ά
kern.boottrace.enabledβ Set to1to enable tracing. This is a read-onlysysctl(8)variable. Default:0(disabled). so like, look but don't touch πkern.boottrace.logβ Show the events stored in boot-time and run-time tables. This is an opaquesysctl(8)variable.kern.boottrace.runtraceβ Same askern.boottrace.boottrace, but write to the run-time table.kern.boottrace.shuttraceβ Same askern.boottrace.boottrace, but write to the shutdown-time table.kern.boottrace.shutdown_traceβ Log shutdown-time events to the console before the system halts.kern.boottrace.shutdown_trace_thresholdβ Set a time threshold for logging shutdown-time events in milliseconds. An event is ignored if the time difference to the previous event is less than the threshold value. Default:0(logs all events).
π EXAMPLES π
Create a new trace event with a process name βfooβ and an event description βbarβ using sysctl(8):
sysctl kern.boottrace.boottrace="foo:bar"
Here is a sample output of kern.boottrace.log (shortened with β[...]β for readability):
CPU msecs delta process event PID CPUtime IBlks OBlks
0 44872811 0 kernel sysinit 0x2100001 0 0.00 0 0
0 44872812 1 kernel sysinit 0x2110000 0 0.00 0 0
0 44872812 0 kernel sysinit 0x2140000 0 0.00 0 0
[...]
0 44872817 0 kernel sysinit 0x2800000 0 0.00 0 0
0 44873820 1003 kernel sysinit 0x2880000 0 0.00 0 0
0 44873820 0 kernel sysinit 0x2888000 0 0.00 0 0
[...]
1 44875735 0 kernel sysinit 0xfffffff 0 0.00 0 0
1 44875735 0 swapper mi_startup done 0 0.00 0 0
0 44875750 15 init init(8) starting... 1 0.00 0 0
0 44875751 1 init /etc/rc starting... 1 0.00 0 0
0 44875831 80 boottrace /etc/rc.d/rctl start 26 0.00 0 0
1 44875839 8 boottrace /etc/rc.d/rctl done 26 0.00 2 0
[...]
0 44876446 0 boottrace /etc/rc.d/netif start 390 0.00 0 0
1 44881116 4670 boottrace /etc/rc.d/netif done 390 0.12 34 0
[...]
0 44882866 1 boottrace /etc/rc.d/securelevel start 1679 0.00 0 0
0 44882872 6 boottrace /etc/rc.d/securelevel done 1679 0.00 0 0
1 44882879 7 init /etc/rc finished 1 2.22 743 15
Total measured time: 10068 msecs
CPU msecs delta process event PID CPUtime IBlks OBlks
1 44882880 0 init multi-user start 1 2.22 743 15
0 44918215 35335 kldload hwpmc.ko: sysinit 0xd800000 1698 0.00 0 0
Total measured time: 35335 msecs
π SEE ALSO π
go check out tslog(4), boottrace(8), and sysctl(8) β bestie homework, but make it cute π¦
π HISTORY π
NetApp created boottrace to diagnose slow devices and subsystems. Once upstreamed, boottrace was first publicly released with FreeBSD 14.0. glow-up story fr fr β¨
π§ AUTHORS π§
This manual page was written by Mateusz Piotrowski <0mp@FreeBSD.org>.
xoxo, Debian π July 1, 2022 π BOOTTRACE(4) forever, bestie π«Ά
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- π the page's license: BSD-2-Clause
- Copyright (c) 2022 NetApp, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms