2 .\" Copyright (c) 2002 Chad David
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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.
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
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.10 2007/06/08 18:24:22 dillon Exp $
34 .Nd print kernel ktr trace buffer
44 utility is used to dump the contents of the kernel ktr trace buffer.
46 The following options are available:
47 .Bl -tag -width ".Fl N Ar execfile"
49 Print all fields. Implies all print options.
51 Print the CPU number that each entry was logged from.
53 Print the file and line number that each entry was logged from.
55 Print the ID string field, identifying the facility being logged.
58 will loop waiting for new data rather then exit.
61 normally tries to translate the caller fields and (when easily parsed)
62 trace arguments into symbols. This option forces hex values to be
63 displayed instead. This option will also cause relative timestamps to
64 be displayed as TSC timestamps rather than converted to microseconds.
68 Quiet mode; do not print the column header.
70 Print relative timestamps in microseconds, rather than absolute TSC
73 Attempt to merge the KTR logs for all cpus into a single time-sorted
74 log. For the numbers to make any sense you probably want to turn
76 .Va debug.ktr.resynchronize
77 sysctl variable. This sysctl causes the kernel to periodically
78 calculate the drift between each cpu's TSC and apply a correction.
80 Print the call chain leading up to the procedure which issued
83 Print the timestamp for each entry.
87 The kernel image to resolve symbols from.
88 The default is the value returned via
91 The core file or memory image to read from.
95 The file to write the output to.
96 The default is standard output.
101 should keep in mind that the act of trace logging will itself effect
102 execution overheads. On a 2Ghz cpu a logging call can take anywhere
103 from 40ns to 150ns to run.
105 The TSC counter is used on cpus equipped with it (which is all modern cpus).
106 The TSC counters may not be synchronized on SMP systems and may drift even
107 between cores on multi-core cpus. Enabling synchronization between cpus
109 .Va debug.ktr.resynchronize
110 sysctl will impose additional system overheads and will generally only be
111 accurate to within 100ns or so (and perhaps not even that good).
112 Resynchronization only occurs 10 times a second and serious drift will
113 cause a great deal of measurement noise when trying to compare events occurring
114 on two different cpus.
118 option should be aware that events for each cpu are independently logged
119 and one cpu might have more events logged then another, causing earlier
120 events to be discarded sooner then other cpus. The beginning portion of
121 the sorted output may thus show MP related events for one cpu with no
122 corresponding events for other cpus.
124 It is possible to somewhat characterize KTR logging overheads by setting
126 .Va debug.ktr.testlogcnt
127 sysctl and then observing test logging events in the KTR output. Tests 1-3
128 log four dummy arguments while tests 4-6 log no arguments.
130 It is possible to characterize IPI messaging latencies by setting the
131 .Va debug.ktr.testipicnt
132 sysctl. A small number between 1 and 1000 is recommended. This will
133 cause the system to ping pong a single IPI message between cpu 0 and cpu 1
134 asynchronously that number of times, as fast as it can. A
136 should be performed almost immediately after setting the sysctl or you
137 might miss the logged events.
144 utility first appeared in
150 utility was originally implemented by
151 .An Jake Burkholder Aq jake@FreeBSD.org .
152 This manual page was originally written by
153 .An Chad David Aq davidc@FreeBSD.org .
154 The program and manual page were rewritten pretty much from