xref: /original-bsd/usr.bin/ktrace/ktrace.1 (revision 69b3a7fc)
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)ktrace.1	5.2 (Berkeley) 01/17/91
7.\"
8.Dd
9.Dt KTRACE 1
10.Sh NAME
11.Nm ktrace
12.Nd enable kernel process tracing
13.Sh SYNOPSIS
14.Nm ktrace
15.Op Fl aCcdi
16.Op Fl f Ar trfile
17.Op Fl g Ar pgrp
18.Op Fl p Ar pid
19.Op Fl t Ar trstr
20.Nm ktrace
21.Op Fl adi
22.Op Fl f Ar trfile
23.Op Fl t Ar trstr
24command
25.Sh DESCRIPTION
26.Nm Ktrace
27enables kernel trace logging for the specified processes.
28Kernel trace data is logged to the file ``ktrace.out''.
29The kernel operations that are traced include system calls, namei
30translations, signal processing, and I/O.
31.Pp
32Once tracing is enabled on a process, trace data will be logged until
33either the process exits or the trace point is cleared.
34A traced process can generate enormous amounts of log data quickly;
35It is strongly suggested that users memorize how to disable tracing before
36attempting to trace a process.
37The following command is sufficient to disable tracing on all user owned
38processes, and, if executed by root, all processes:
39.Pp
40.Dl \&$ trace -C
41.Pp
42The trace file is not human readable; use
43.Xr kdump 1
44to decode it.
45.Pp
46The options are as follows:
47.Tw Ds
48.Tp Fl a
49Append to the trace file instead of truncating it.
50.Tp Fl C
51Disable tracing on all user owned processes, and, if executed by root, all
52processes in the system.
53.Tp Fl c
54Clear the trace points associated with the specified file or processes.
55.Tp Fl d
56Descendants; perform the operation for all current children of the
57designated processes.
58.Tc Fl f
59.Ws
60.Ar file
61.Cx
62Log trace records to
63.Ar file
64instead of ``ktrace.out''.
65.Tc Fl g
66.Ws
67.Ar pgid
68.Cx
69Enable (disable) tracing on all processes in the process group (only one
70.Fl g
71flag is permitted).
72.Tp Fl i
73Inherit; pass the trace flags to all future children of the designated
74processes.
75.Tc Fl p
76.Ws
77.Ar pid
78.Cx
79Enable (disable) tracing on the indicated process id (only one
80.Fl p
81flag is permitted).
82.Tc Fl t
83.Ws
84.Ar trstr
85.Cx
86The string argument represents the kernel trace points, one per letter.
87The following table equates the letters with the tracepoints:
88.Dw Dp
89.Dp Cm c
90trace system calls
91.Dp Cm n
92trace namei translations
93.Dp Cm i
94trace I/O
95.Dp Cm s
96trace signal processing
97.Dp
98.Tp Ar command
99Execute
100.Ar command
101with the specified trace flags.
102.Tp
103.Pp
104The
105.Fl p ,
106.Fl g ,
107and command options are mutually exclusive.
108.Sh EXAMPLES
109# trace all kernel operations of process id 34
110.Dl $ ktrace -p 34
111.sp
112# trace all kernel operations of processes in process group 15 and
113# pass the trace flags to all current and future children
114.Dl $ ktrace -g 15
115.sp
116# disable all tracing of process 65
117.Dl $ ktrace -cp 65
118.sp
119# disable tracing signals on process 70 and all current children
120.Dl $ ktrace -ts -cip 70
121.sp
122# enable tracing of i/o on process 67
123.Dl $ ktrace -ti -p 67
124.sp
125# run the command "w", tracing only system calls
126.Dl $ ktrace -tc w
127.sp
128# disable all tracing to the file "tracedata"
129.Dl $ ktrace -c -f tracedata
130.sp
131# disable tracing of all processes owned by the user
132.Dl $ ktrace -C
133.Sh SEE ALSO
134.Xr kdump 1
135.Sh HISTORY
1364.4 BSD.
137