| 1 | /*	$OpenBSD: vmmeter.h,v 1.15 2016/07/27 14:44:59 tedu Exp $	*/ |
| 2 | /*	$NetBSD: vmmeter.h,v 1.9 1995/03/26 20:25:04 jtc Exp $	*/ |
| 3 | |
| 4 | /*- |
| 5 | * Copyright (c) 1982, 1986, 1993 |
| 6 | *	The Regents of the University of California. All rights reserved. |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions |
| 10 | * are met: |
| 11 | * 1. Redistributions of source code must retain the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer. |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer in the |
| 15 | * documentation and/or other materials provided with the distribution. |
| 16 | * 3. Neither the name of the University nor the names of its contributors |
| 17 | * may be used to endorse or promote products derived from this software |
| 18 | * without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | * SUCH DAMAGE. |
| 31 | * |
| 32 | *	@(#)vmmeter.h	8.2 (Berkeley) 7/10/94 |
| 33 | */ |
| 34 | |
| 35 | #ifndef	__VMMETER_H__ |
| 36 | #define	__VMMETER_H__ |
| 37 | |
| 38 | /* |
| 39 | * System wide statistics counters. Look in <uvm/uvm_extern.h> for the |
| 40 | * UVM equivalent. |
| 41 | */ |
| 42 | |
| 43 | /* systemwide totals computed every five seconds */ |
| 44 | struct vmtotal { |
| 45 | 	u_int16_t t_rq;		/* length of the run queue */ |
| 46 | 	u_int16_t t_dw;		/* jobs in ``disk wait'' (neg priority) */ |
| 47 | 	u_int16_t t_pw;		/* jobs in page wait */ |
| 48 | 	u_int16_t t_sl;		/* jobs sleeping in core */ |
| 49 | 	u_int16_t t_sw;		/* swapped out runnable/short block jobs */ |
| 50 | 	u_int32_t t_vm;		/* total virtual memory */ |
| 51 | 	u_int32_t t_avm;	/* active virtual memory */ |
| 52 | 	u_int32_t t_rm;		/* total real memory in use */ |
| 53 | 	u_int32_t t_arm;	/* active real memory */ |
| 54 | 	u_int32_t t_vmshr;	/* shared virtual memory */ |
| 55 | 	u_int32_t t_avmshr;	/* active shared virtual memory */ |
| 56 | 	u_int32_t t_rmshr;	/* shared real memory */ |
| 57 | 	u_int32_t t_armshr;	/* active shared real memory */ |
| 58 | 	u_int32_t t_free;	/* free memory pages */ |
| 59 | }; |
| 60 | |
| 61 | /* |
| 62 | * Fork/vfork/__tfork accounting. |
| 63 | */ |
| 64 | struct forkstat { |
| 65 | 	uint32_t	cntfork;	/* number of fork() calls */ |
| 66 | 	uint32_t	cntvfork;	/* number of vfork() calls */ |
| 67 | 	uint32_t	cnttfork;	/* number of __tfork() calls */ |
| 68 | 	uint32_t	cntkthread;	/* number of kernel threads created */ |
| 69 | 	uint64_t	sizfork;	/* VM pages affected by fork() */ |
| 70 | 	uint64_t	sizvfork;	/* VM pages affected by vfork() */ |
| 71 | 	uint64_t	siztfork;	/* VM pages affected by __tfork() */ |
| 72 | 	uint64_t	sizkthread;	/* VM pages affected by kernel threads */ |
| 73 | }; |
| 74 | |
| 75 | /* These sysctl names are only really used by sysctl(8) */ |
| 76 | #define KERN_FORKSTAT_FORK		1 |
| 77 | #define KERN_FORKSTAT_VFORK		2 |
| 78 | #define KERN_FORKSTAT_TFORK		3 |
| 79 | #define KERN_FORKSTAT_KTHREAD		4 |
| 80 | #define KERN_FORKSTAT_SIZFORK		5 |
| 81 | #define KERN_FORKSTAT_SIZVFORK		6 |
| 82 | #define KERN_FORKSTAT_SIZTFORK		7 |
| 83 | #define KERN_FORKSTAT_SIZKTHREAD	8 |
| 84 | #define KERN_FORKSTAT_MAXID		9 |
| 85 | |
| 86 | #define CTL_KERN_FORKSTAT_NAMES { \ |
| 87 | 	{ 0, 0 }, \ |
| 88 | 	{ "forks", CTLTYPE_INT }, \ |
| 89 | 	{ "vforks", CTLTYPE_INT }, \ |
| 90 | 	{ "tforks", CTLTYPE_INT }, \ |
| 91 | 	{ "kthreads", CTLTYPE_INT }, \ |
| 92 | 	{ "fork_pages", CTLTYPE_INT }, \ |
| 93 | 	{ "vfork_pages", CTLTYPE_INT }, \ |
| 94 | 	{ "tfork_pages", CTLTYPE_INT }, \ |
| 95 | 	{ "kthread_pages", CTLTYPE_INT }, \ |
| 96 | } |
| 97 | #endif /* __VMMETER_H__ */ |