1.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD 2.\" 3.\" Copyright (c) 2022 Mateusz Piotrowski <0mp@FreeBSD.org> 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 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. 13.\" 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 24.\" SUCH DAMAGE. 25.\" 26.Dd March 4, 2022 27.Dt TSLOG 4 28.Os 29.Sh NAME 30.Nm tslog 31.Nd Boot-time event tracing facility 32.Sh SYNOPSIS 33To compile this boot-time event tracing facility into the kernel, 34place the following line in the kernel configuration file: 35.Bd -ragged -offset indent 36.Cd "option TSLOG" 37.Ed 38.Sh DESCRIPTION 39.Nm 40is a boot-time event tracing facility. 41Its purpose is to ease diagnosing and reducing the overall 42.Fx 43boot time by generating detailed timing information. 44.Pp 45.Nm 46is able to trace the boot loader, kernel initialization, and userland processes. 47.Pp 48In userland, it records the following details for each process ID: 49.Bl -dash 50.It 51The timestamp of the 52.Xr fork 2 53which creates the given process ID and the parent process ID. 54.It 55The path passed to 56.Xr execve 2 , 57if any. 58.It 59The first path resolved by 60.Xr namei 9 , 61if any. 62.It 63The timestamp of the 64.Xr exit 3 65which terminates the process. 66.El 67.Sh SYSCTL VARIABLES 68The following 69.Xr sysctl 8 70variables are available: 71.Bl -tag -width indent 72.It Va debug.tslog 73Dump the 74.Nm 75buffer of recorded loader and kernel event timestamps. 76.It Va debug.tslog_user 77Dump the 78.Nm 79buffer 80of recorded userland event timestamps. 81.El 82.Sh FLAMEGRAPHS 83The 84.Nm 85buffer dumps 86can be used to generate flamegraphs of the 87.Fx 88boot process for visual analysis. 89See 90.Lk https://github.com/cperciva/freebsd-boot-profiling 91for more information. 92.Sh SEE ALSO 93.Xr dtrace 1 , 94.Xr boottrace 4 , 95.Xr ktr 4 96.Sh HISTORY 97.Nm 98first appeared in 99.Fx 12.0 . 100Support for tracing boot loaders and userland process 101was added in 102.Fx 14.0 . 103.Ss TSLOG vs. Boottrace 104.Nm 105is oriented towards system developers while 106.Xr boottrace 4 107is meant to be easy to use by system administrators. 108Both faciliities provide an overview of timing and resource usage of the boot 109process. 110.Ss TSLOG vs. DTrace 111.Xr dtrace 1 112is not always the right tool for profiling early kernel initialization. 113The reason is it requires some kernel subroutines 114which are not yet available early in the boot process, e.g.: 115traps, memory allocation, or thread scheduling. 116.Nm 117depends on fewer kernel subroutines than 118.Xr dtrace 1 119and because of that can trace early kernel initialization. 120.Ss TSLOG vs. KTR 121.Xr ktr 4 122has a couple of limitations which prevent it from 123being able to run at the start of the boot process. 124In contrast, 125.Nm 126is designed for logging timestamped events for boot 127profiling. 128.Sh AUTHORS 129.An -nosplit 130.Nm 131was written by 132.An Colin Percival Aq Mt cperciva@FreeBSD.org . 133.Pp 134This manual page was written by 135.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org . 136