xref: /csrg-svn/usr.bin/ktrace/ktrace.1 (revision 45987)
144955Scael.\" Copyright (c) 1990 The Regents of the University of California.
244955Scael.\" All rights reserved.
344955Scael.\"
444955Scael.\" %sccs.include.redist.man%
544955Scael.\"
6*45987Sbostic.\"     @(#)ktrace.1	5.1 (Berkeley) 01/17/91
744955Scael.\"
844955Scael.Dd
944955Scael.Dt KTRACE 1
1044955Scael.Sh NAME
1144955Scael.Nm ktrace
1244955Scael.Nd enable kernel process tracing
1344955Scael.Sh SYNOPSIS
1444955Scael.Nm ktrace
15*45987Sbostic.Op Fl aCcdi
16*45987Sbostic.Op Fl f Ar trfile
17*45987Sbostic.Op Fl g Ar pgrp
1844955Scael.Op Fl p Ar pid
1944955Scael.Op Fl t Ar trstr
2044955Scael.Nm ktrace
21*45987Sbostic.Op Fl adi
2244955Scael.Op Fl f Ar trfile
23*45987Sbostic.Op Fl t Ar trstr
24*45987Sbosticcommand
2544955Scael.Sh DESCRIPTION
2644955Scael.Nm Ktrace
2744955Scaelenables kernel trace logging for the specified processes.
28*45987SbosticKernel trace data is logged to the file ``ktrace.out''.
29*45987SbosticThe kernel operations that are traced include system calls, namei
30*45987Sbostictranslations, signal processing, and I/O.
3144955Scael.Pp
32*45987SbosticOnce tracing is enabled on a process, trace data will be logged until
33*45987Sbosticeither the process exits or the trace point is cleared.
34*45987SbosticA traced process can generate enormous amounts of log data quickly;
35*45987SbosticIt is strongly suggested that users memorize how to disable tracing before
36*45987Sbosticattempting to trace a process.
37*45987SbosticThe following command is sufficient to disable tracing on all user owned
38*45987Sbosticprocesses, and, if executed by root, all processes:
39*45987Sbostic.Pp
4044955Scael.Dl \&$ trace -C
4144955Scael.Pp
42*45987SbosticThe trace file is not human readable; use
4344955Scael.Xr kdump 1
4444955Scaelto decode it.
45*45987Sbostic.Pp
46*45987SbosticThe options are as follows:
4744955Scael.Tw Ds
48*45987Sbostic.Tp Fl a
49*45987SbosticAppend to the trace file instead of truncating it.
5044955Scael.Tp Fl C
51*45987SbosticDisable tracing on all user owned processes, and, if executed by root, all
52*45987Sbosticprocesses in the system.
53*45987Sbostic.Tp Fl c
54*45987SbosticClear the trace points associated with the specified file or process(es).
5544955Scael.Tc Fl f
5644955Scael.Ws
57*45987Sbostic.Ar file
5844955Scael.Cx
5944955ScaelLog trace records to
60*45987Sbostic.Ar file
61*45987Sbosticinstead of ``ktrace.out''.
62*45987Sbostic.Tc Fl g
63*45987Sbostic.Ws
64*45987Sbostic.Ar pgid
65*45987Sbostic.Cx
66*45987SbosticEnable (disable) tracing on all processes in the process group (only one
67*45987Sbostic.Fl g
68*45987Sbosticflag is permitted).
69*45987Sbostic.Tp Fl i
70*45987SbosticInherit; pass the trace flag to all future children of the designated
71*45987Sbosticprocesses.
72*45987Sbostic.Tc Fl p
73*45987Sbostic.Ws
74*45987Sbostic.Ar pid
75*45987Sbostic.Cx
76*45987SbosticEnable (disable) tracing on the indicated process id (only one
77*45987Sbostic.Fl p
78*45987Sbosticflag is permitted).
7944955Scael.Tc Fl t
8044955Scael.Ws
8144955Scael.Ar trstr
8244955Scael.Cx
83*45987SbosticThe string argument represents the kernel trace points, one per letter.
84*45987SbosticThe following table equates the letters with the tracepoints:
85*45987Sbostic.Dw Dp
8644955Scael.Dp Cm c
8744955Scaeltrace system calls
8844955Scael.Dp Cm n
8944955Scaeltrace namei translations
9044955Scael.Dp Cm i
9144955Scaeltrace I/O
9244955Scael.Dp Cm s
93*45987Sbostictrace signal processing
9444955Scael.Dp
9544955Scael.Tp Ar command
96*45987SbosticExecute
9744955Scael.Ar command
9844955Scaelwith the specified trace flags.
9944955Scael.Tp
10044955Scael.Pp
10144955ScaelThe
10244955Scael.Fl p ,
10344955Scael.Fl g ,
10444955Scaeland command options are mutually exclusive.
10544955Scael.Sh EXAMPLES
10644583Smarc# trace all kernel operations of process id 34
107*45987Sbostic.Dl $ ktrace -p 34
108*45987Sbostic.sp
10944583Smarc# trace all kernel operations of processes in process group 15 and
11037231Smarc# pass the trace flags to all current and future children
111*45987Sbostic.Dl $ ktrace -g 15
112*45987Sbostic.sp
11344583Smarc# disable all tracing of process 65
114*45987Sbostic.Dl $ ktrace -cp 65
115*45987Sbostic.sp
11644583Smarc# disable tracing signals on process 70 and all current children
117*45987Sbostic.Dl $ ktrace -ts -cip 70
118*45987Sbostic.sp
11944583Smarc# enable tracing of i/o on process 67
120*45987Sbostic.Dl $ ktrace -ti -p 67
121*45987Sbostic.sp
12244583Smarc# run the command "w", tracing only system calls
12344955Scael.Dl $ ktrace -tc w
124*45987Sbostic.sp
12537231Smarc# disable all tracing to the file "tracedata"
12644955Scael.Dl $ ktrace -c -f tracedata
127*45987Sbostic.sp
12844583Smarc# disable tracing of all processes owned by the user
12944955Scael.Dl $ ktrace -C
13044955Scael.Sh SEE ALSO
13144955Scael.Xr kdump 1
13244955Scael.Sh HISTORY
13344955Scael4.4 BSD.
134