14d846d26SWarner Losh.\" SPDX-License-Identifier: BSD-2-Clause 25675bb58SMateusz Piotrowski.\" 35675bb58SMateusz Piotrowski.\" Copyright (c) 2022 Mateusz Piotrowski <0mp@FreeBSD.org> 45675bb58SMateusz Piotrowski.\" 55675bb58SMateusz Piotrowski.\" Redistribution and use in source and binary forms, with or without 65675bb58SMateusz Piotrowski.\" modification, are permitted provided that the following conditions 75675bb58SMateusz Piotrowski.\" are met: 85675bb58SMateusz Piotrowski.\" 1. Redistributions of source code must retain the above copyright 95675bb58SMateusz Piotrowski.\" notice, this list of conditions and the following disclaimer. 105675bb58SMateusz Piotrowski.\" 2. Redistributions in binary form must reproduce the above copyright 115675bb58SMateusz Piotrowski.\" notice, this list of conditions and the following disclaimer in the 125675bb58SMateusz Piotrowski.\" documentation and/or other materials provided with the distribution. 135675bb58SMateusz Piotrowski.\" 145675bb58SMateusz Piotrowski.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 155675bb58SMateusz Piotrowski.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 165675bb58SMateusz Piotrowski.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 175675bb58SMateusz Piotrowski.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 185675bb58SMateusz Piotrowski.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 195675bb58SMateusz Piotrowski.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 205675bb58SMateusz Piotrowski.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 215675bb58SMateusz Piotrowski.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 225675bb58SMateusz Piotrowski.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 235675bb58SMateusz Piotrowski.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 245675bb58SMateusz Piotrowski.\" SUCH DAMAGE. 255675bb58SMateusz Piotrowski.\" 269e337d53SMateusz Piotrowski.Dd June 1, 2022 275675bb58SMateusz Piotrowski.Dt TSLOG 4 285675bb58SMateusz Piotrowski.Os 295675bb58SMateusz Piotrowski.Sh NAME 305675bb58SMateusz Piotrowski.Nm tslog 315675bb58SMateusz Piotrowski.Nd Boot-time event tracing facility 325675bb58SMateusz Piotrowski.Sh SYNOPSIS 335675bb58SMateusz PiotrowskiTo compile this boot-time event tracing facility into the kernel, 345675bb58SMateusz Piotrowskiplace the following line in the kernel configuration file: 355675bb58SMateusz Piotrowski.Bd -ragged -offset indent 365675bb58SMateusz Piotrowski.Cd "option TSLOG" 375675bb58SMateusz Piotrowski.Ed 385675bb58SMateusz Piotrowski.Sh DESCRIPTION 395675bb58SMateusz Piotrowski.Nm 405675bb58SMateusz Piotrowskiis a boot-time event tracing facility. 419e337d53SMateusz PiotrowskiIt is suitable for tracing recursive events 429e337d53SMateusz Piotrowskibased on function entries and exits. 439e337d53SMateusz PiotrowskiIts purpose is to ease pinpointing and reducing the overall 445675bb58SMateusz Piotrowski.Fx 455675bb58SMateusz Piotrowskiboot time by generating detailed timing information. 465675bb58SMateusz Piotrowski.Pp 475675bb58SMateusz Piotrowski.Nm 485675bb58SMateusz Piotrowskiis able to trace the boot loader, kernel initialization, and userland processes. 495675bb58SMateusz Piotrowski.Pp 505675bb58SMateusz PiotrowskiIn userland, it records the following details for each process ID: 515675bb58SMateusz Piotrowski.Bl -dash 525675bb58SMateusz Piotrowski.It 535675bb58SMateusz PiotrowskiThe timestamp of the 545675bb58SMateusz Piotrowski.Xr fork 2 555675bb58SMateusz Piotrowskiwhich creates the given process ID and the parent process ID. 565675bb58SMateusz Piotrowski.It 575675bb58SMateusz PiotrowskiThe path passed to 585675bb58SMateusz Piotrowski.Xr execve 2 , 595675bb58SMateusz Piotrowskiif any. 605675bb58SMateusz Piotrowski.It 615675bb58SMateusz PiotrowskiThe first path resolved by 625675bb58SMateusz Piotrowski.Xr namei 9 , 635675bb58SMateusz Piotrowskiif any. 645675bb58SMateusz Piotrowski.It 655675bb58SMateusz PiotrowskiThe timestamp of the 665675bb58SMateusz Piotrowski.Xr exit 3 675675bb58SMateusz Piotrowskiwhich terminates the process. 685675bb58SMateusz Piotrowski.El 695675bb58SMateusz Piotrowski.Sh SYSCTL VARIABLES 705675bb58SMateusz PiotrowskiThe following 715675bb58SMateusz Piotrowski.Xr sysctl 8 725675bb58SMateusz Piotrowskivariables are available: 735675bb58SMateusz Piotrowski.Bl -tag -width indent 745675bb58SMateusz Piotrowski.It Va debug.tslog 755675bb58SMateusz PiotrowskiDump the 765675bb58SMateusz Piotrowski.Nm 775675bb58SMateusz Piotrowskibuffer of recorded loader and kernel event timestamps. 785675bb58SMateusz Piotrowski.It Va debug.tslog_user 795675bb58SMateusz PiotrowskiDump the 805675bb58SMateusz Piotrowski.Nm 815675bb58SMateusz Piotrowskibuffer 825675bb58SMateusz Piotrowskiof recorded userland event timestamps. 835675bb58SMateusz Piotrowski.El 845675bb58SMateusz Piotrowski.Sh FLAMEGRAPHS 855675bb58SMateusz PiotrowskiThe 865675bb58SMateusz Piotrowski.Nm 875675bb58SMateusz Piotrowskibuffer dumps 885675bb58SMateusz Piotrowskican be used to generate flamegraphs of the 895675bb58SMateusz Piotrowski.Fx 905675bb58SMateusz Piotrowskiboot process for visual analysis. 915675bb58SMateusz PiotrowskiSee 925675bb58SMateusz Piotrowski.Lk https://github.com/cperciva/freebsd-boot-profiling 935675bb58SMateusz Piotrowskifor more information. 945675bb58SMateusz Piotrowski.Sh SEE ALSO 955675bb58SMateusz Piotrowski.Xr dtrace 1 , 965675bb58SMateusz Piotrowski.Xr boottrace 4 , 975675bb58SMateusz Piotrowski.Xr ktr 4 985675bb58SMateusz Piotrowski.Sh HISTORY 995675bb58SMateusz Piotrowski.Nm 1005675bb58SMateusz Piotrowskifirst appeared in 1015675bb58SMateusz Piotrowski.Fx 12.0 . 1025675bb58SMateusz PiotrowskiSupport for tracing boot loaders and userland process 1035675bb58SMateusz Piotrowskiwas added in 104*ba719a0fSTom Hukins.Fx 13.2 . 1055675bb58SMateusz Piotrowski.Ss TSLOG vs. Boottrace 1065675bb58SMateusz Piotrowski.Nm 1075675bb58SMateusz Piotrowskiis oriented towards system developers while 1085675bb58SMateusz Piotrowski.Xr boottrace 4 1095675bb58SMateusz Piotrowskiis meant to be easy to use by system administrators. 110c9966384SPiotr Pawel StefaniakBoth facilities provide an overview of timing and resource usage of the boot 1115675bb58SMateusz Piotrowskiprocess. 1125675bb58SMateusz Piotrowski.Ss TSLOG vs. DTrace 1135675bb58SMateusz Piotrowski.Xr dtrace 1 1145675bb58SMateusz Piotrowskiis not always the right tool for profiling early kernel initialization. 1155675bb58SMateusz PiotrowskiThe reason is it requires some kernel subroutines 1165675bb58SMateusz Piotrowskiwhich are not yet available early in the boot process, e.g.: 117cebd29c9SGordon Berglingtraps, memory allocation, or thread scheduling. 1185675bb58SMateusz Piotrowski.Nm 1195675bb58SMateusz Piotrowskidepends on fewer kernel subroutines than 1205675bb58SMateusz Piotrowski.Xr dtrace 1 1215675bb58SMateusz Piotrowskiand because of that can trace early kernel initialization. 1225675bb58SMateusz Piotrowski.Ss TSLOG vs. KTR 1235675bb58SMateusz Piotrowski.Xr ktr 4 1245675bb58SMateusz Piotrowskihas a couple of limitations which prevent it from 1255675bb58SMateusz Piotrowskibeing able to run at the start of the boot process. 1265675bb58SMateusz PiotrowskiIn contrast, 1275675bb58SMateusz Piotrowski.Nm 1285675bb58SMateusz Piotrowskiis designed for logging timestamped events for boot 1295675bb58SMateusz Piotrowskiprofiling. 1305675bb58SMateusz Piotrowski.Sh AUTHORS 1315675bb58SMateusz Piotrowski.An -nosplit 1325675bb58SMateusz Piotrowski.Nm 1335675bb58SMateusz Piotrowskiwas written by 1345675bb58SMateusz Piotrowski.An Colin Percival Aq Mt cperciva@FreeBSD.org . 1355675bb58SMateusz Piotrowski.Pp 1365675bb58SMateusz PiotrowskiThis manual page was written by 1375675bb58SMateusz Piotrowski.An Mateusz Piotrowski Aq Mt 0mp@FreeBSD.org . 138