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. 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 * @(#)vmmeter.h 8.2 (Berkeley) 7/10/94 30 * $FreeBSD: src/sys/sys/vmmeter.h,v 1.21.2.2 2002/10/10 19:28:21 dillon Exp $ 31 * $DragonFly: src/sys/sys/vmmeter.h,v 1.10 2006/05/20 02:42:13 dillon Exp $ 32 */ 33 34 #ifndef _SYS_VMMETER_H_ 35 #define _SYS_VMMETER_H_ 36 37 #ifndef _SYS_TYPES_H_ 38 #include <sys/types.h> 39 #endif 40 41 /* 42 * System wide statistics counters. 43 */ 44 struct vmmeter { 45 /* 46 * General system activity. 47 */ 48 #define vmmeter_uint_begin v_swtch 49 u_int v_swtch; /* context switches */ 50 u_int v_trap; /* calls to trap */ 51 u_int v_syscall; /* calls to syscall() */ 52 u_int v_intr; /* device interrupts */ 53 u_int v_ipi; /* inter processor interrupts */ 54 u_int v_timer; /* LAPIC timer interrupts */ 55 u_int v_soft; /* software interrupts */ 56 /* 57 * Virtual memory activity. 58 */ 59 u_int v_vm_faults; /* number of address memory faults */ 60 u_int v_cow_faults; /* number of copy-on-writes */ 61 u_int v_cow_optim; /* number of optimized copy-on-writes */ 62 u_int v_zfod; /* pages zero filled on demand */ 63 u_int v_ozfod; /* optimized zero fill pages */ 64 u_int v_swapin; /* swap pager pageins */ 65 u_int v_swapout; /* swap pager pageouts */ 66 u_int v_swappgsin; /* swap pager pages paged in */ 67 u_int v_swappgsout; /* swap pager pages paged out */ 68 u_int v_vnodein; /* vnode pager pageins */ 69 u_int v_vnodeout; /* vnode pager pageouts */ 70 u_int v_vnodepgsin; /* vnode_pager pages paged in */ 71 u_int v_vnodepgsout; /* vnode pager pages paged out */ 72 u_int v_intrans; /* intransit blocking page faults */ 73 u_int v_reactivated; /* number of pages reactivated from free list */ 74 u_int v_pdwakeups; /* number of times daemon has awaken from sleep */ 75 u_int v_pdpages; /* number of pages analyzed by daemon */ 76 77 u_int v_dfree; /* pages freed by daemon */ 78 u_int v_pfree; /* pages freed by exiting processes */ 79 u_int v_tfree; /* total pages freed */ 80 /* 81 * Fork/vfork/rfork activity. 82 */ 83 u_int v_forks; /* number of fork() calls */ 84 u_int v_vforks; /* number of vfork() calls */ 85 u_int v_rforks; /* number of rfork() calls */ 86 u_int v_exec; /* number of exec() calls */ 87 u_int v_kthreads; /* number of fork() calls by kernel */ 88 u_int v_forkpages; /* number of VM pages affected by fork() */ 89 u_int v_vforkpages; /* number of VM pages affected by vfork() */ 90 u_int v_rforkpages; /* number of VM pages affected by rfork() */ 91 u_int v_kthreadpages; /* number of VM pages affected by fork() by kernel */ 92 u_int v_intrans_coll; /* intransit map collisions (total) */ 93 u_int v_intrans_wait; /* intransit map collisions which blocked */ 94 u_int v_forwarded_ints; /* forwarded interrupts due to MP lock */ 95 u_int v_forwarded_hits; 96 u_int v_forwarded_misses; 97 u_int v_sendsys; /* calls to sendsys() */ 98 u_int v_waitsys; /* calls to waitsys() */ 99 u_int v_smpinvltlb; /* nasty global invltlbs */ 100 u_int v_ppwakeups; /* wakeups on processes stalled on VM */ 101 u_int v_lock_colls; /* # of token, lock, or spin collisions */ 102 char v_lock_name[16]; /* last-colliding token, lock, or spin name */ 103 u_int v_reserved6; 104 u_int v_reserved7; 105 #define vmmeter_uint_end v_reserved7 106 }; 107 108 struct vmstats { 109 /* 110 * Distribution of page usages. 111 */ 112 u_int v_page_size; /* page size in bytes */ 113 u_int v_page_count; /* total number of pages in system */ 114 u_int v_free_reserved; /* number of pages reserved for deadlock */ 115 u_int v_free_target; /* number of pages desired free */ 116 u_int v_free_min; /* minimum number of pages desired free */ 117 u_int v_free_count; /* number of pages free */ 118 u_int v_wire_count; /* number of pages wired down */ 119 u_int v_active_count; /* number of pages active */ 120 u_int v_inactive_target; /* number of pages desired inactive */ 121 u_int v_inactive_count; /* number of pages inactive */ 122 u_int v_cache_count; /* number of pages on buffer cache queue */ 123 u_int v_cache_min; /* min number of pages desired on cache queue */ 124 u_int v_cache_max; /* max number of pages in cached obj */ 125 u_int v_pageout_free_min; /* min number pages reserved for kernel */ 126 u_int v_interrupt_free_min; /* reserved number of pages for int code */ 127 u_int v_free_severe; /* severe depletion of pages below this pt */ 128 u_int v_dma_avail; /* free dma-reserved pages */ 129 u_int v_dma_pages; /* total dma-reserved pages */ 130 u_int v_unused[8]; 131 }; 132 133 #ifdef _KERNEL 134 135 /* note: vmmeter 'cnt' structure is now per-cpu */ 136 extern struct vmstats vmstats; 137 138 #endif 139 140 /* systemwide totals computed every five seconds */ 141 struct vmtotal { 142 long t_rq; /* length of the run queue */ 143 long t_dw; /* jobs in ``disk wait'' (neg priority) */ 144 long t_pw; /* jobs in page wait */ 145 long t_sl; /* jobs sleeping in core */ 146 long t_sw; /* swapped out runnable/short block jobs */ 147 int64_t t_vm; /* total virtual memory */ 148 int64_t t_avm; /* active virtual memory */ 149 long t_rm; /* total real memory in use */ 150 long t_arm; /* active real memory */ 151 int64_t t_vmshr; /* shared virtual memory */ 152 int64_t t_avmshr; /* active shared virtual memory */ 153 long t_rmshr; /* shared real memory */ 154 long t_armshr; /* active shared real memory */ 155 long t_free; /* free memory pages */ 156 }; 157 158 #ifdef PGINPROF 159 /* 160 * Optional instrumentation. 161 */ 162 163 #define NDMON 128 164 #define NSMON 128 165 166 #define DRES 20 167 #define SRES 5 168 169 #define PMONMIN 20 170 #define PRES 50 171 #define NPMON 64 172 173 #define RMONMIN 130 174 #define RRES 5 175 #define NRMON 64 176 177 /* data and stack size distribution counters */ 178 u_int dmon[NDMON+1]; 179 u_int smon[NSMON+1]; 180 181 /* page in time distribution counters */ 182 u_int pmon[NPMON+2]; 183 184 /* reclaim time distribution counters */ 185 u_int rmon[NRMON+2]; 186 187 int pmonmin; 188 int pres; 189 int rmonmin; 190 int rres; 191 192 u_int rectime; /* accumulator for reclaim times */ 193 u_int pgintime; /* accumulator for page in times */ 194 195 #endif /* PGINPROF */ 196 #endif 197