1*5675bb58SMateusz Piotrowski.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD 2*5675bb58SMateusz Piotrowski.\" 3*5675bb58SMateusz Piotrowski.\" Copyright (c) 2022 Mateusz Piotrowski <0mp@FreeBSD.org> 4*5675bb58SMateusz Piotrowski.\" 5*5675bb58SMateusz Piotrowski.\" Redistribution and use in source and binary forms, with or without 6*5675bb58SMateusz Piotrowski.\" modification, are permitted provided that the following conditions 7*5675bb58SMateusz Piotrowski.\" are met: 8*5675bb58SMateusz Piotrowski.\" 1. Redistributions of source code must retain the above copyright 9*5675bb58SMateusz Piotrowski.\" notice, this list of conditions and the following disclaimer. 10*5675bb58SMateusz Piotrowski.\" 2. Redistributions in binary form must reproduce the above copyright 11*5675bb58SMateusz Piotrowski.\" notice, this list of conditions and the following disclaimer in the 12*5675bb58SMateusz Piotrowski.\" documentation and/or other materials provided with the distribution. 13*5675bb58SMateusz Piotrowski.\" 14*5675bb58SMateusz Piotrowski.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15*5675bb58SMateusz Piotrowski.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16*5675bb58SMateusz Piotrowski.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17*5675bb58SMateusz Piotrowski.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18*5675bb58SMateusz Piotrowski.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19*5675bb58SMateusz Piotrowski.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20*5675bb58SMateusz Piotrowski.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21*5675bb58SMateusz Piotrowski.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22*5675bb58SMateusz Piotrowski.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23*5675bb58SMateusz Piotrowski.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24*5675bb58SMateusz Piotrowski.\" SUCH DAMAGE. 25*5675bb58SMateusz Piotrowski.\" 26*5675bb58SMateusz Piotrowski.Dd March 4, 2022 27*5675bb58SMateusz Piotrowski.Dt TSLOG 4 28*5675bb58SMateusz Piotrowski.Os 29*5675bb58SMateusz Piotrowski.Sh NAME 30*5675bb58SMateusz Piotrowski.Nm tslog 31*5675bb58SMateusz Piotrowski.Nd Boot-time event tracing facility 32*5675bb58SMateusz Piotrowski.Sh SYNOPSIS 33*5675bb58SMateusz PiotrowskiTo compile this boot-time event tracing facility into the kernel, 34*5675bb58SMateusz Piotrowskiplace the following line in the kernel configuration file: 35*5675bb58SMateusz Piotrowski.Bd -ragged -offset indent 36*5675bb58SMateusz Piotrowski.Cd "option TSLOG" 37*5675bb58SMateusz Piotrowski.Ed 38*5675bb58SMateusz Piotrowski.Sh DESCRIPTION 39*5675bb58SMateusz Piotrowski.Nm 40*5675bb58SMateusz Piotrowskiis a boot-time event tracing facility. 41*5675bb58SMateusz PiotrowskiIts purpose is to ease diagnosing and reducing the overall 42*5675bb58SMateusz Piotrowski.Fx 43*5675bb58SMateusz Piotrowskiboot time by generating detailed timing information. 44*5675bb58SMateusz Piotrowski.Pp 45*5675bb58SMateusz Piotrowski.Nm 46*5675bb58SMateusz Piotrowskiis able to trace the boot loader, kernel initialization, and userland processes. 47*5675bb58SMateusz Piotrowski.Pp 48*5675bb58SMateusz PiotrowskiIn userland, it records the following details for each process ID: 49*5675bb58SMateusz Piotrowski.Bl -dash 50*5675bb58SMateusz Piotrowski.It 51*5675bb58SMateusz PiotrowskiThe timestamp of the 52*5675bb58SMateusz Piotrowski.Xr fork 2 53*5675bb58SMateusz Piotrowskiwhich creates the given process ID and the parent process ID. 54*5675bb58SMateusz Piotrowski.It 55*5675bb58SMateusz PiotrowskiThe path passed to 56*5675bb58SMateusz Piotrowski.Xr execve 2 , 57*5675bb58SMateusz Piotrowskiif any. 58*5675bb58SMateusz Piotrowski.It 59*5675bb58SMateusz PiotrowskiThe first path resolved by 60*5675bb58SMateusz Piotrowski.Xr namei 9 , 61*5675bb58SMateusz Piotrowskiif any. 62*5675bb58SMateusz Piotrowski.It 63*5675bb58SMateusz PiotrowskiThe timestamp of the 64*5675bb58SMateusz Piotrowski.Xr exit 3 65*5675bb58SMateusz Piotrowskiwhich terminates the process. 66*5675bb58SMateusz Piotrowski.El 67*5675bb58SMateusz Piotrowski.Sh SYSCTL VARIABLES 68*5675bb58SMateusz PiotrowskiThe following 69*5675bb58SMateusz Piotrowski.Xr sysctl 8 70*5675bb58SMateusz Piotrowskivariables are available: 71*5675bb58SMateusz Piotrowski.Bl -tag -width indent 72*5675bb58SMateusz Piotrowski.It Va debug.tslog 73*5675bb58SMateusz PiotrowskiDump the 74*5675bb58SMateusz Piotrowski.Nm 75*5675bb58SMateusz Piotrowskibuffer of recorded loader and kernel event timestamps. 76*5675bb58SMateusz Piotrowski.It Va debug.tslog_user 77*5675bb58SMateusz PiotrowskiDump the 78*5675bb58SMateusz Piotrowski.Nm 79*5675bb58SMateusz Piotrowskibuffer 80*5675bb58SMateusz Piotrowskiof recorded userland event timestamps. 81*5675bb58SMateusz Piotrowski.El 82*5675bb58SMateusz Piotrowski.Sh FLAMEGRAPHS 83*5675bb58SMateusz PiotrowskiThe 84*5675bb58SMateusz Piotrowski.Nm 85*5675bb58SMateusz Piotrowskibuffer dumps 86*5675bb58SMateusz Piotrowskican be used to generate flamegraphs of the 87*5675bb58SMateusz Piotrowski.Fx 88*5675bb58SMateusz Piotrowskiboot process for visual analysis. 89*5675bb58SMateusz PiotrowskiSee 90*5675bb58SMateusz Piotrowski.Lk https://github.com/cperciva/freebsd-boot-profiling 91*5675bb58SMateusz Piotrowskifor more information. 92*5675bb58SMateusz Piotrowski.Sh SEE ALSO 93*5675bb58SMateusz Piotrowski.Xr dtrace 1 , 94*5675bb58SMateusz Piotrowski.Xr boottrace 4 , 95*5675bb58SMateusz Piotrowski.Xr ktr 4 96*5675bb58SMateusz Piotrowski.Sh HISTORY 97*5675bb58SMateusz Piotrowski.Nm 98*5675bb58SMateusz Piotrowskifirst appeared in 99*5675bb58SMateusz Piotrowski.Fx 12.0 . 100*5675bb58SMateusz PiotrowskiSupport for tracing boot loaders and userland process 101*5675bb58SMateusz Piotrowskiwas added in 102*5675bb58SMateusz Piotrowski.Fx 14.0 . 103*5675bb58SMateusz Piotrowski.Ss TSLOG vs. Boottrace 104*5675bb58SMateusz Piotrowski.Nm 105*5675bb58SMateusz Piotrowskiis oriented towards system developers while 106*5675bb58SMateusz Piotrowski.Xr boottrace 4 107*5675bb58SMateusz Piotrowskiis meant to be easy to use by system administrators. 108*5675bb58SMateusz PiotrowskiBoth faciliities provide an overview of timing and resource usage of the boot 109*5675bb58SMateusz Piotrowskiprocess. 110*5675bb58SMateusz Piotrowski.Ss TSLOG vs. DTrace 111*5675bb58SMateusz Piotrowski.Xr dtrace 1 112*5675bb58SMateusz Piotrowskiis not always the right tool for profiling early kernel initialization. 113*5675bb58SMateusz PiotrowskiThe reason is it requires some kernel subroutines 114*5675bb58SMateusz Piotrowskiwhich are not yet available early in the boot process, e.g.: 115*5675bb58SMateusz Piotrowskitraps, memory allocation, or thread schedulling. 116*5675bb58SMateusz Piotrowski.Nm 117*5675bb58SMateusz Piotrowskidepends on fewer kernel subroutines than 118*5675bb58SMateusz Piotrowski.Xr dtrace 1 119*5675bb58SMateusz Piotrowskiand because of that can trace early kernel initialization. 120*5675bb58SMateusz Piotrowski.Ss TSLOG vs. KTR 121*5675bb58SMateusz Piotrowski.Xr ktr 4 122*5675bb58SMateusz Piotrowskihas a couple of limitations which prevent it from 123*5675bb58SMateusz Piotrowskibeing able to run at the start of the boot process. 124*5675bb58SMateusz PiotrowskiIn contrast, 125*5675bb58SMateusz Piotrowski.Nm 126*5675bb58SMateusz Piotrowskiis designed for logging timestamped events for boot 127*5675bb58SMateusz Piotrowskiprofiling. 128*5675bb58SMateusz Piotrowski.Sh AUTHORS 129*5675bb58SMateusz Piotrowski.An -nosplit 130*5675bb58SMateusz Piotrowski.Nm 131*5675bb58SMateusz Piotrowskiwas written by 132*5675bb58SMateusz Piotrowski.An Colin Percival Aq Mt cperciva@FreeBSD.org . 133*5675bb58SMateusz Piotrowski.Pp 134*5675bb58SMateusz PiotrowskiThis manual page was written by 135*5675bb58SMateusz Piotrowski.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org . 136