1 /*- 2 * Copyright (c) 1982, 1986, 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. All advertising materials mentioning features or use of this software 14 * must display the following acknowledgement: 15 * This product includes software developed by the University of 16 * California, Berkeley and its contributors. 17 * 4. Neither the name of the University nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)vmmeter.h 8.2 (Berkeley) 7/10/94 34 * $FreeBSD: src/sys/sys/vmmeter.h,v 1.21.2.2 2002/10/10 19:28:21 dillon Exp $ 35 * $DragonFly: src/sys/sys/vmmeter.h,v 1.10 2006/05/20 02:42:13 dillon Exp $ 36 */ 37 38 #ifndef _SYS_VMMETER_H_ 39 #define _SYS_VMMETER_H_ 40 41 #ifndef _SYS_TYPES_H_ 42 #include <sys/types.h> 43 #endif 44 45 /* 46 * System wide statistics counters. 47 */ 48 struct vmmeter { 49 /* 50 * General system activity. 51 */ 52 #define vmmeter_uint_begin v_swtch 53 u_int v_swtch; /* context switches */ 54 u_int v_trap; /* calls to trap */ 55 u_int v_syscall; /* calls to syscall() */ 56 u_int v_intr; /* device interrupts */ 57 u_int v_ipi; /* inter processor interrupts */ 58 u_int v_timer; /* LAPIC timer interrupts */ 59 u_int v_soft; /* software interrupts */ 60 /* 61 * Virtual memory activity. 62 */ 63 u_int v_vm_faults; /* number of address memory faults */ 64 u_int v_cow_faults; /* number of copy-on-writes */ 65 u_int v_cow_optim; /* number of optimized copy-on-writes */ 66 u_int v_zfod; /* pages zero filled on demand */ 67 u_int v_ozfod; /* optimized zero fill pages */ 68 u_int v_swapin; /* swap pager pageins */ 69 u_int v_swapout; /* swap pager pageouts */ 70 u_int v_swappgsin; /* swap pager pages paged in */ 71 u_int v_swappgsout; /* swap pager pages paged out */ 72 u_int v_vnodein; /* vnode pager pageins */ 73 u_int v_vnodeout; /* vnode pager pageouts */ 74 u_int v_vnodepgsin; /* vnode_pager pages paged in */ 75 u_int v_vnodepgsout; /* vnode pager pages paged out */ 76 u_int v_intrans; /* intransit blocking page faults */ 77 u_int v_reactivated; /* number of pages reactivated from free list */ 78 u_int v_pdwakeups; /* number of times daemon has awaken from sleep */ 79 u_int v_pdpages; /* number of pages analyzed by daemon */ 80 81 u_int v_dfree; /* pages freed by daemon */ 82 u_int v_pfree; /* pages freed by exiting processes */ 83 u_int v_tfree; /* total pages freed */ 84 /* 85 * Fork/vfork/rfork activity. 86 */ 87 u_int v_forks; /* number of fork() calls */ 88 u_int v_vforks; /* number of vfork() calls */ 89 u_int v_rforks; /* number of rfork() calls */ 90 u_int v_exec; /* number of exec() calls */ 91 u_int v_kthreads; /* number of fork() calls by kernel */ 92 u_int v_forkpages; /* number of VM pages affected by fork() */ 93 u_int v_vforkpages; /* number of VM pages affected by vfork() */ 94 u_int v_rforkpages; /* number of VM pages affected by rfork() */ 95 u_int v_kthreadpages; /* number of VM pages affected by fork() by kernel */ 96 u_int v_intrans_coll; /* intransit map collisions (total) */ 97 u_int v_intrans_wait; /* intransit map collisions which blocked */ 98 u_int v_forwarded_ints; /* forwarded interrupts due to MP lock */ 99 u_int v_forwarded_hits; 100 u_int v_forwarded_misses; 101 u_int v_sendsys; /* calls to sendsys() */ 102 u_int v_waitsys; /* calls to waitsys() */ 103 u_int v_smpinvltlb; /* nasty global invltlbs */ 104 u_int v_ppwakeups; /* wakeups on processes stalled on VM */ 105 u_int v_reserved1; 106 u_int v_reserved2; 107 u_int v_reserved3; 108 u_int v_reserved4; 109 u_int v_reserved5; 110 u_int v_reserved6; 111 u_int v_reserved7; 112 #define vmmeter_uint_end v_reserved7 113 }; 114 115 struct vmstats { 116 /* 117 * Distribution of page usages. 118 */ 119 u_int v_page_size; /* page size in bytes */ 120 u_int v_page_count; /* total number of pages in system */ 121 u_int v_free_reserved; /* number of pages reserved for deadlock */ 122 u_int v_free_target; /* number of pages desired free */ 123 u_int v_free_min; /* minimum number of pages desired free */ 124 u_int v_free_count; /* number of pages free */ 125 u_int v_wire_count; /* number of pages wired down */ 126 u_int v_active_count; /* number of pages active */ 127 u_int v_inactive_target; /* number of pages desired inactive */ 128 u_int v_inactive_count; /* number of pages inactive */ 129 u_int v_cache_count; /* number of pages on buffer cache queue */ 130 u_int v_cache_min; /* min number of pages desired on cache queue */ 131 u_int v_cache_max; /* max number of pages in cached obj */ 132 u_int v_pageout_free_min; /* min number pages reserved for kernel */ 133 u_int v_interrupt_free_min; /* reserved number of pages for int code */ 134 u_int v_free_severe; /* severe depletion of pages below this pt */ 135 u_int v_dma_avail; /* free dma-reserved pages */ 136 u_int v_dma_pages; /* total dma-reserved pages */ 137 u_int v_unused[8]; 138 }; 139 140 #ifdef _KERNEL 141 142 /* note: vmmeter 'cnt' structure is now per-cpu */ 143 extern struct vmstats vmstats; 144 145 #endif 146 147 /* systemwide totals computed every five seconds */ 148 struct vmtotal 149 { 150 long t_rq; /* length of the run queue */ 151 long t_dw; /* jobs in ``disk wait'' (neg priority) */ 152 long t_pw; /* jobs in page wait */ 153 long t_sl; /* jobs sleeping in core */ 154 long t_sw; /* swapped out runnable/short block jobs */ 155 int64_t t_vm; /* total virtual memory */ 156 int64_t t_avm; /* active virtual memory */ 157 long t_rm; /* total real memory in use */ 158 long t_arm; /* active real memory */ 159 int64_t t_vmshr; /* shared virtual memory */ 160 int64_t t_avmshr; /* active shared virtual memory */ 161 long t_rmshr; /* shared real memory */ 162 long t_armshr; /* active shared real memory */ 163 long t_free; /* free memory pages */ 164 }; 165 166 #ifdef PGINPROF 167 /* 168 * Optional instrumentation. 169 */ 170 171 #define NDMON 128 172 #define NSMON 128 173 174 #define DRES 20 175 #define SRES 5 176 177 #define PMONMIN 20 178 #define PRES 50 179 #define NPMON 64 180 181 #define RMONMIN 130 182 #define RRES 5 183 #define NRMON 64 184 185 /* data and stack size distribution counters */ 186 u_int dmon[NDMON+1]; 187 u_int smon[NSMON+1]; 188 189 /* page in time distribution counters */ 190 u_int pmon[NPMON+2]; 191 192 /* reclaim time distribution counters */ 193 u_int rmon[NRMON+2]; 194 195 int pmonmin; 196 int pres; 197 int rmonmin; 198 int rres; 199 200 u_int rectime; /* accumulator for reclaim times */ 201 u_int pgintime; /* accumulator for page in times */ 202 203 #endif /* PGINPROF */ 204 #endif 205