MP Implementation 1/2: Get the APIC code working again, sweetly integrate the
[dragonfly.git] / sys / sys / vmmeter.h
CommitLineData
984263bc
MD
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 $
8a8d5d85 35 * $DragonFly: src/sys/sys/vmmeter.h,v 1.5 2003/07/06 21:23:54 dillon Exp $
984263bc
MD
36 */
37
38#ifndef _SYS_VMMETER_H_
39#define _SYS_VMMETER_H_
40
41/*
42 * System wide statistics counters.
43 */
44struct vmmeter {
45 /*
46 * General system activity.
47 */
6bdb32ed 48#define vmmeter_uint_begin v_swtch
984263bc
MD
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_soft; /* software interrupts */
54 /*
55 * Virtual memory activity.
56 */
57 u_int v_vm_faults; /* number of address memory faults */
58 u_int v_cow_faults; /* number of copy-on-writes */
59 u_int v_cow_optim; /* number of optimized copy-on-writes */
60 u_int v_zfod; /* pages zero filled on demand */
61 u_int v_ozfod; /* optimized zero fill pages */
62 u_int v_swapin; /* swap pager pageins */
63 u_int v_swapout; /* swap pager pageouts */
64 u_int v_swappgsin; /* swap pager pages paged in */
65 u_int v_swappgsout; /* swap pager pages paged out */
66 u_int v_vnodein; /* vnode pager pageins */
67 u_int v_vnodeout; /* vnode pager pageouts */
68 u_int v_vnodepgsin; /* vnode_pager pages paged in */
69 u_int v_vnodepgsout; /* vnode pager pages paged out */
70 u_int v_intrans; /* intransit blocking page faults */
71 u_int v_reactivated; /* number of pages reactivated from free list */
72 u_int v_pdwakeups; /* number of times daemon has awaken from sleep */
73 u_int v_pdpages; /* number of pages analyzed by daemon */
74
75 u_int v_dfree; /* pages freed by daemon */
76 u_int v_pfree; /* pages freed by exiting processes */
77 u_int v_tfree; /* total pages freed */
12e4aaff
MD
78 /*
79 * Fork/vfork/rfork activity.
80 */
81 u_int v_forks; /* number of fork() calls */
82 u_int v_vforks; /* number of vfork() calls */
83 u_int v_rforks; /* number of rfork() calls */
84 u_int v_kthreads; /* number of fork() calls by kernel */
85 u_int v_forkpages; /* number of VM pages affected by fork() */
86 u_int v_vforkpages; /* number of VM pages affected by vfork() */
87 u_int v_rforkpages; /* number of VM pages affected by rfork() */
88 u_int v_kthreadpages; /* number of VM pages affected by fork() by kernel */
89 u_int v_intrans_coll; /* intransit map collisions (total) */
90 u_int v_intrans_wait; /* intransit map collisions which blocked */
8a8d5d85
MD
91 u_int v_forwarded_ints;
92 u_int v_forwarded_hits;
93 u_int v_forwarded_misses;
94#define vmmeter_uint_end v_forwarded_misses
12e4aaff
MD
95};
96
97struct vmstats {
984263bc
MD
98 /*
99 * Distribution of page usages.
100 */
101 u_int v_page_size; /* page size in bytes */
102 u_int v_page_count; /* total number of pages in system */
103 u_int v_free_reserved; /* number of pages reserved for deadlock */
104 u_int v_free_target; /* number of pages desired free */
105 u_int v_free_min; /* minimum number of pages desired free */
106 u_int v_free_count; /* number of pages free */
107 u_int v_wire_count; /* number of pages wired down */
108 u_int v_active_count; /* number of pages active */
109 u_int v_inactive_target; /* number of pages desired inactive */
110 u_int v_inactive_count; /* number of pages inactive */
111 u_int v_cache_count; /* number of pages on buffer cache queue */
112 u_int v_cache_min; /* min number of pages desired on cache queue */
113 u_int v_cache_max; /* max number of pages in cached obj */
114 u_int v_pageout_free_min; /* min number pages reserved for kernel */
115 u_int v_interrupt_free_min; /* reserved number of pages for int code */
116 u_int v_free_severe; /* severe depletion of pages below this pt */
984263bc 117};
984263bc 118
12e4aaff 119#ifdef _KERNEL
984263bc 120
12e4aaff
MD
121/* note: vmmeter 'cnt' structure is now per-cpu */
122extern struct vmstats vmstats;
984263bc
MD
123
124#endif
125
126/* systemwide totals computed every five seconds */
127struct vmtotal
128{
129 int16_t t_rq; /* length of the run queue */
130 int16_t t_dw; /* jobs in ``disk wait'' (neg priority) */
131 int16_t t_pw; /* jobs in page wait */
132 int16_t t_sl; /* jobs sleeping in core */
133 int16_t t_sw; /* swapped out runnable/short block jobs */
134 int32_t t_vm; /* total virtual memory */
135 int32_t t_avm; /* active virtual memory */
136 int32_t t_rm; /* total real memory in use */
137 int32_t t_arm; /* active real memory */
138 int32_t t_vmshr; /* shared virtual memory */
139 int32_t t_avmshr; /* active shared virtual memory */
140 int32_t t_rmshr; /* shared real memory */
141 int32_t t_armshr; /* active shared real memory */
142 int32_t t_free; /* free memory pages */
143};
144
12e4aaff 145#ifdef PGINPROF
984263bc
MD
146/*
147 * Optional instrumentation.
148 */
984263bc
MD
149
150#define NDMON 128
151#define NSMON 128
152
153#define DRES 20
154#define SRES 5
155
156#define PMONMIN 20
157#define PRES 50
158#define NPMON 64
159
160#define RMONMIN 130
161#define RRES 5
162#define NRMON 64
163
164/* data and stack size distribution counters */
165u_int dmon[NDMON+1];
166u_int smon[NSMON+1];
167
168/* page in time distribution counters */
169u_int pmon[NPMON+2];
170
171/* reclaim time distribution counters */
172u_int rmon[NRMON+2];
173
174int pmonmin;
175int pres;
176int rmonmin;
177int rres;
178
179u_int rectime; /* accumulator for reclaim times */
180u_int pgintime; /* accumulator for page in times */
984263bc 181
12e4aaff 182#endif /* PGINPROF */
984263bc 183#endif