1.\" $NetBSD: kgmon.8,v 1.19 2011/04/25 22:46:35 wiz 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 Ar core 70Extract values associated with the name list from the specified 71.Ar core 72instead of the default 73.Pa /dev/kmem . 74.It Fl N Ar system 75Extract the name list from the specified 76.Ar system 77instead of the default 78.Pa /netbsd . 79.It Fl p 80Dump the contents of the profile buffers into a 81.Pa gmon.out 82file. 83.It Fl r 84Reset all the profile buffers. 85If the 86.Fl p 87flag is also specified, the 88.Pa gmon.out 89file is generated before the buffers are reset. 90.El 91.Pp 92If neither 93.Fl b 94nor 95.Fl h 96is specified, the state of profiling collection remains unchanged. 97For example, if the 98.Fl p 99flag is specified and profile data is being collected, 100profiling will be momentarily suspended, 101the operating system profile buffers will be dumped, 102and profiling will be immediately resumed. 103.Sh FILES 104.Bl -tag -width /dev/kmemx -compact 105.It Pa /netbsd 106the default system 107.It Pa /dev/kmem 108the default memory 109.El 110.Sh DIAGNOSTICS 111Users with only read permission on 112.Pa /dev/kmem 113cannot change the state of 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 config 1 , 120.Xr gprof 1 121.Sh HISTORY 122The 123.Nm 124command appeared in 125.Bx 4.2 . 126