xref: /openbsd/usr.sbin/kgmon/kgmon.8 (revision 9d0b46bc)
1.\" $OpenBSD: kgmon.8,v 1.7 2003/06/12 12:59:50 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.7 2003/06/12 12:59:50 jmc Exp $
31.\"
32.Dd June 6, 1993
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 p
71Dump the contents of the profile buffers into a
72.Pa gmon.out
73file.
74.It Fl r
75Reset all the profile buffers.
76If the
77.Fl p
78flag is also specified, the
79.Pa gmon.out
80file is generated before the buffers are reset.
81.It Fl M
82Extract values associated with the name list from the specified core
83instead of the default
84.Pa /dev/kmem .
85.It Fl N
86Extract the name list from the specified system instead of the
87default
88.Pa /bsd .
89.El
90.Pp
91If neither
92.Fl b
93nor
94.Fl h
95is specified, the state of profiling collection remains unchanged.
96For example, if the
97.Fl p
98flag is specified and profile data is being collected,
99profiling will be momentarily suspended,
100the operating system profile buffers will be dumped,
101and profiling will be immediately resumed.
102.Sh FILES
103.Bl -tag -width /dev/kmemx -compact
104.It Pa /bsd
105default system
106.It Pa /dev/kmem
107default memory
108.El
109.Sh DIAGNOSTICS
110Users with only read permission on
111.Pa /dev/kmem
112cannot change the state
113of profiling collection.
114They can get a
115.Pa gmon.out
116file with the warning that the data may be
117inconsistent if profiling is in progress.
118.Sh SEE ALSO
119.Xr gprof 1 ,
120.Xr config 8
121.Sh HISTORY
122The
123.Nm
124command appeared in
125.Bx 4.2 .
126