xref: /openbsd/usr.sbin/kgmon/kgmon.8 (revision 404b540a)
1.\" $OpenBSD: kgmon.8,v 1.9 2007/05/31 19:20:25 jmc Exp $
2.\" Copyright (c) 1983, 1991, 1993
3.\"	The Regents of the University of California.  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.\" 3. Neither the name of the University nor the names of its contributors
14.\"    may be used to endorse or promote products derived from this software
15.\"    without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\"     from: @(#)kgmon.8	8.1 (Berkeley) 6/6/93
30.\"	$Id: kgmon.8,v 1.9 2007/05/31 19:20:25 jmc Exp $
31.\"
32.Dd $Mdocdate: May 31 2007 $
33.Dt KGMON 8
34.Os
35.Sh NAME
36.Nm kgmon
37.Nd generate a dump of the operating system's profile buffers
38.Sh SYNOPSIS
39.Nm kgmon
40.Op Fl bhpr
41.Op Fl M Ar core
42.Op Fl N Ar system
43.Sh DESCRIPTION
44.Nm kgmon
45is a tool used when profiling the operating system.
46When no arguments are supplied,
47.Nm kgmon
48indicates the state of operating system profiling as
49.Dq running ,
50.Dq off ,
51or
52.Dq not configured
53(see
54.Xr config 8 ) .
55If the
56.Fl p
57flag is specified,
58.Nm kgmon
59extracts profile data from the operating system and produces a
60.Pa gmon.out
61file suitable for later analysis by
62.Xr gprof 1 .
63.Pp
64The options are as follows:
65.Bl -tag -width Ds
66.It Fl b
67Resume the collection of profile data.
68.It Fl h
69Stop the collection of profile data.
70.It Fl M Ar core
71Extract values associated with the name list from the specified
72.Ar core
73instead of the default
74.Pa /dev/kmem .
75.It Fl N Ar system
76Extract the name list from the specified
77.Ar system
78instead of the default
79.Pa /bsd .
80.It Fl p
81Dump the contents of the profile buffers into a
82.Pa gmon.out
83file.
84.It Fl r
85Reset all the profile buffers.
86If the
87.Fl p
88flag is also specified, the
89.Pa gmon.out
90file is generated before the buffers are reset.
91.El
92.Pp
93If neither
94.Fl b
95nor
96.Fl h
97is specified, the state of profiling collection remains unchanged.
98For example, if the
99.Fl p
100flag is specified and profile data is being collected,
101profiling will be momentarily suspended,
102the operating system profile buffers will be dumped,
103and profiling will be immediately resumed.
104.Sh FILES
105.Bl -tag -width /dev/kmemx -compact
106.It Pa /bsd
107default system
108.It Pa /dev/kmem
109default memory
110.El
111.Sh DIAGNOSTICS
112Users with only read permission on
113.Pa /dev/kmem
114cannot change the state
115of profiling collection.
116They can get a
117.Pa gmon.out
118file with the warning that the data may be
119inconsistent if profiling is in progress.
120.Sh SEE ALSO
121.Xr gprof 1 ,
122.Xr config 8
123.Sh HISTORY
124The
125.Nm
126command appeared in
127.Bx 4.2 .
128