1 .\" SPDX-License-Identifier: BSD-2-Clause
3 .\" Copyright (c) 2022 NetApp, Inc.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .Nd Boot-time, run-time, and shutdown-time tracing facility
36 is a kernel-userspace interface for capturing trace events
37 during system boot and shutdown
38 .Pq in particular, one-shot events .
40 Event annotations are present in:
43 the boot and shutdown paths in the
46 some key system utilities
58 is unconditionally compiled into the kernel and
61 Events are stored in three event tables: boot-time events, run-time events,
62 and shutdown-time events.
63 .Bl -column "shutdown-time events" ""
64 .It Sy Table Name Ta Sy Event Description
65 .It boot-time events Ta Boot, kernel initialization, and
71 transitions into multi-user mode
73 .It run-time events Ta Xo
74 From when the system has completed booting (including
78 transitions to multi-user mode
79 until the beginning of shutdown procedures
81 .It shutdown-time events Ta Xo
82 After initialization of a shutdown, a reboot, or a kernel panic
86 Tunables can be set at the
88 prompt before booting the kernel or stored in
91 features the following loader tunables:
92 .Bl -tag -width indent
93 .It Va kern.boottrace.dotrace_kernel
96 to enable tracing of kernel events.
100 .It Va kern.boottrace.dotrace_user
103 to enable tracing of userspace events.
109 The following variables are available as both
114 .Bl -tag -width indent
115 .It Va kern.boottrace.boottrace
116 Create a new trace event and write it to the boot-time table.
118 A new trace event consists of a process name and an event description,
121 If the colon is missing or if the provided string for the process name is empty,
122 the process name is inferred from the invoking process
123 .Pq which is its executable name .
124 .It Va kern.boottrace.enabled
134 .It Va kern.boottrace.log
135 Show the events stored in boot-time and run-time
141 .It Va kern.boottrace.runtrace
143 .Va kern.boottrace.boottrace ,
144 but write to the run-time table.
145 .It Va kern.boottrace.shuttrace
147 .Va kern.boottrace.boottrace ,
148 but write to the shutdown-time table.
149 .It Va kern.boottrace.shutdown_trace
150 Log shutdown-time events to the console before the system halts.
151 .It Va kern.boottrace.shutdown_trace_threshold
152 Set a time threshold for logging shutdown-time events in milliseconds.
154 if the time difference to the previous event is less than
158 .Pq logs all events .
161 Create a new trace event with a process name
163 and an event description
167 .Bd -literal -offset indent
168 sysctl kern.boottrace.boottrace="foo:bar"
171 Here is a sample output of
172 .Va kern.boottrace.log
178 CPU msecs delta process event PID CPUtime IBlks OBlks
179 0 44872811 0 kernel sysinit 0x2100001 0 0.00 0 0
180 0 44872812 1 kernel sysinit 0x2110000 0 0.00 0 0
181 0 44872812 0 kernel sysinit 0x2140000 0 0.00 0 0
183 0 44872817 0 kernel sysinit 0x2800000 0 0.00 0 0
184 0 44873820 1003 kernel sysinit 0x2880000 0 0.00 0 0
185 0 44873820 0 kernel sysinit 0x2888000 0 0.00 0 0
187 1 44875735 0 kernel sysinit 0xfffffff 0 0.00 0 0
188 1 44875735 0 swapper mi_startup done 0 0.00 0 0
189 0 44875750 15 init init(8) starting... 1 0.00 0 0
190 0 44875751 1 init /etc/rc starting... 1 0.00 0 0
191 0 44875831 80 boottrace /etc/rc.d/rctl start 26 0.00 0 0
192 1 44875839 8 boottrace /etc/rc.d/rctl done 26 0.00 2 0
194 0 44876446 0 boottrace /etc/rc.d/netif start 390 0.00 0 0
195 1 44881116 4670 boottrace /etc/rc.d/netif done 390 0.12 34 0
197 0 44882866 1 boottrace /etc/rc.d/securelevel start 1679 0.00 0 0
198 0 44882872 6 boottrace /etc/rc.d/securelevel done 1679 0.00 0 0
199 1 44882879 7 init /etc/rc finished 1 2.22 743 15
200 Total measured time: 10068 msecs
203 CPU msecs delta process event PID CPUtime IBlks OBlks
204 1 44882880 0 init multi-user start 1 2.22 743 15
205 0 44918215 35335 kldload hwpmc.ko: sysinit 0xd800000 1698 0.00 0 0
206 Total measured time: 35335 msecs
215 to diagnose slow devices and subsystems.
218 was first publicly released with
221 This manual page was written by
222 .An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org .