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