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