xref: /csrg-svn/usr.bin/ktrace/ktrace.1 (revision 45987)
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.1 (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 process(es).
55.Tc Fl f
56.Ws
57.Ar file
58.Cx
59Log trace records to
60.Ar file
61instead of ``ktrace.out''.
62.Tc Fl g
63.Ws
64.Ar pgid
65.Cx
66Enable (disable) tracing on all processes in the process group (only one
67.Fl g
68flag is permitted).
69.Tp Fl i
70Inherit; pass the trace flag to all future children of the designated
71processes.
72.Tc Fl p
73.Ws
74.Ar pid
75.Cx
76Enable (disable) tracing on the indicated process id (only one
77.Fl p
78flag is permitted).
79.Tc Fl t
80.Ws
81.Ar trstr
82.Cx
83The string argument represents the kernel trace points, one per letter.
84The following table equates the letters with the tracepoints:
85.Dw Dp
86.Dp Cm c
87trace system calls
88.Dp Cm n
89trace namei translations
90.Dp Cm i
91trace I/O
92.Dp Cm s
93trace signal processing
94.Dp
95.Tp Ar command
96Execute
97.Ar command
98with the specified trace flags.
99.Tp
100.Pp
101The
102.Fl p ,
103.Fl g ,
104and command options are mutually exclusive.
105.Sh EXAMPLES
106# trace all kernel operations of process id 34
107.Dl $ ktrace -p 34
108.sp
109# trace all kernel operations of processes in process group 15 and
110# pass the trace flags to all current and future children
111.Dl $ ktrace -g 15
112.sp
113# disable all tracing of process 65
114.Dl $ ktrace -cp 65
115.sp
116# disable tracing signals on process 70 and all current children
117.Dl $ ktrace -ts -cip 70
118.sp
119# enable tracing of i/o on process 67
120.Dl $ ktrace -ti -p 67
121.sp
122# run the command "w", tracing only system calls
123.Dl $ ktrace -tc w
124.sp
125# disable all tracing to the file "tracedata"
126.Dl $ ktrace -c -f tracedata
127.sp
128# disable tracing of all processes owned by the user
129.Dl $ ktrace -C
130.Sh SEE ALSO
131.Xr kdump 1
132.Sh HISTORY
1334.4 BSD.
134