kernel - Fix excessive mbuf use in nfs_realign()
[dragonfly.git] / usr.bin / ktrdump / ktrdump.8
1 .\"-
2 .\" Copyright (c) 2002 Chad David
3 .\" All rights reserved.
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 .\" $FreeBSD: src/usr.bin/ktrdump/ktrdump.8,v 1.7 2005/03/08 06:58:56 hmp Exp $
27 .\" $DragonFly: src/usr.bin/ktrdump/ktrdump.8,v 1.16 2008/11/10 02:05:31 swildner Exp $
28 .\"
29 .Dd November 9, 2008
30 .Dt KTRDUMP 8
31 .Os
32 .Sh NAME
33 .Nm ktrdump
34 .Nd print kernel ktr trace buffer
35 .Sh SYNOPSIS
36 .Nm
37 .Op Fl acdfilnpqrstx
38 .Op Fl A Ar factor
39 .Op Fl N Ar execfile
40 .Op Fl M Ar corefile
41 .Op Fl o Ar outfile
42 .Sh DESCRIPTION
43 The
44 .Nm
45 utility is used to dump the contents of the kernel ktr trace buffer.
46 .Pp
47 The following options are available:
48 .Bl -tag -width ".Fl N Ar execfile"
49 .It Fl a
50 Print most fields.
51 Implies
52 .Fl c
53 .Fl i
54 .Fl x
55 .Fl p
56 .Fl r ,
57 and
58 .Fl s .
59 Note that
60 .Fl f
61 is not included.
62 .It Fl c
63 Print the CPU number that each entry was logged from.
64 .It Fl d
65 Dump an event stream to the file specified with
66 .Fl o .
67 This stream can be examined with
68 .Xr evtranalyze 1 .
69 .It Fl f
70 Print the file and line number that each entry was logged from.
71 .It Fl i
72 Print the ID string field, identifying the facility being logged.
73 .It Fl l
74 .Nm
75 will loop waiting for new data rather than exit.
76 .It Fl n
77 .Nm
78 normally tries to translate the caller fields and (when easily parsed)
79 trace arguments into symbols.
80 This option forces hex values to be displayed instead.
81 This option will also cause relative timestamps to
82 be displayed as TSC timestamps rather than converted to microseconds.
83 .It Fl p
84 Print the trace data.
85 .It Fl q
86 Quiet mode; do not print the column header.
87 .It Fl r
88 Print relative timestamps in microseconds, rather than absolute TSC
89 timestamps.
90 .It Fl s
91 Attempt to merge the KTR logs for all cpus into a single time-sorted
92 log.
93 For the numbers to make any sense you probably want to turn on the
94 .Va debug.ktr.resynchronize
95 .Xr sysctl 3
96 variable.
97 This sysctl causes the kernel to periodically
98 calculate the drift between each CPU's TSC and apply a correction.
99 .It Fl t
100 Print the timestamp for each entry.
101 .It Fl x
102 Print the call chain leading up to the procedure which issued
103 the KTR.
104 .It Fl A Ar factor
105 Specify a correction factor to be applied to attempt to remove the
106 overhead of the KTR logging call itself.
107 .It Fl N Ar execfile
108 The kernel image to resolve symbols from.
109 The default is the value returned via
110 .Xr getbootfile 3 .
111 .It Fl M Ar corefile
112 The core file or memory image to read from.
113 The default is
114 .Pa /dev/mem .
115 .It Fl o Ar outfile
116 The file to write the output to.
117 The default is standard output.
118 .El
119 .Sh OPERATIONAL NOTES
120 Users of
121 .Nm
122 should keep in mind that the act of trace logging will itself affect
123 execution overheads.
124 On a 2Ghz cpu a logging call can take anywhere from 40ns to 150ns to run.
125 .Pp
126 The TSC counter is used on cpus equipped with it (which is all modern cpus).
127 The TSC counters may not be synchronized on SMP systems and may drift even
128 between cores on multi-core cpus.
129 Enabling synchronization between cpus via the
130 .Va debug.ktr.resynchronize
131 sysctl will impose additional system overheads and will generally only be
132 accurate to within 100ns or so (and perhaps not even that good).
133 Resynchronization only occurs 10 times a second and serious drift will
134 cause a great deal of measurement noise when trying to compare events occurring
135 on two different cpus.
136 .Pp
137 Users using the
138 .Fl s
139 option should be aware that events for each cpu are independently logged
140 and one cpu might have more events logged then another, causing earlier
141 events to be discarded sooner then other cpus.
142 The beginning portion of
143 the sorted output may thus show MP related events for one cpu with no
144 corresponding events for other cpus.
145 .Pp
146 It is possible to somewhat characterize KTR logging overheads by setting
147 the
148 .Va debug.ktr.testlogcnt
149 sysctl and then observing test logging events in the KTR output.
150 Tests 1-3 log four dummy arguments while tests 4-6 log no arguments.
151 .Pp
152 It is possible to characterize IPI messaging latencies by setting the
153 .Va debug.ktr.testipicnt
154 sysctl.
155 A small number between 1 and 1000 is recommended.
156 This will
157 cause the system to ping pong a single IPI message between cpu 0 and cpu 1
158 asynchronously that number of times, as fast as it can.
159 A
160 .Nm
161 should be performed almost immediately after setting the sysctl or you
162 might miss the logged events.
163 .Sh SEE ALSO
164 .Xr ktr 4 ,
165 .Xr ktr 9
166 .Sh HISTORY
167 The
168 .Nm
169 utility first appeared in
170 .Fx 5.0 .
171 .Sh AUTHORS
172 .An -nosplit
173 The
174 .Nm
175 utility was originally implemented by
176 .An Jake Burkholder Aq jake@FreeBSD.org .
177 This manual page was originally written by
178 .An Chad David Aq davidc@FreeBSD.org .
179 The program and manual page were rewritten pretty much from
180 scratch by
181 .An Matthew Dillon
182 for
183 .Dx .