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