Deleted Added
full compact
vm_meter.c (71999) vm_meter.c (72200)
1/*
2 * Copyright (c) 1982, 1986, 1989, 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

--- 17 unchanged lines hidden (view full) ---

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 * @(#)vm_meter.c 8.4 (Berkeley) 1/4/94
1/*
2 * Copyright (c) 1982, 1986, 1989, 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

--- 17 unchanged lines hidden (view full) ---

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 * @(#)vm_meter.c 8.4 (Berkeley) 1/4/94
34 * $FreeBSD: head/sys/vm/vm_meter.c 71999 2001-02-04 13:13:25Z phk $
34 * $FreeBSD: head/sys/vm/vm_meter.c 72200 2001-02-09 06:11:45Z bmilekic $
35 */
36
37#include <sys/param.h>
38#include <sys/proc.h>
39#include <sys/systm.h>
40#include <sys/kernel.h>
41#include <sys/resource.h>
42#include <sys/vmmeter.h>

--- 105 unchanged lines hidden (view full) ---

148 vm_object_clear_flag(object, OBJ_ACTIVE);
149 /*
150 * Calculate process statistics.
151 */
152 ALLPROC_LOCK(AP_SHARED);
153 LIST_FOREACH(p, &allproc, p_list) {
154 if (p->p_flag & P_SYSTEM)
155 continue;
35 */
36
37#include <sys/param.h>
38#include <sys/proc.h>
39#include <sys/systm.h>
40#include <sys/kernel.h>
41#include <sys/resource.h>
42#include <sys/vmmeter.h>

--- 105 unchanged lines hidden (view full) ---

148 vm_object_clear_flag(object, OBJ_ACTIVE);
149 /*
150 * Calculate process statistics.
151 */
152 ALLPROC_LOCK(AP_SHARED);
153 LIST_FOREACH(p, &allproc, p_list) {
154 if (p->p_flag & P_SYSTEM)
155 continue;
156 mtx_enter(&sched_lock, MTX_SPIN);
156 mtx_lock_spin(&sched_lock);
157 switch (p->p_stat) {
158 case 0:
157 switch (p->p_stat) {
158 case 0:
159 mtx_exit(&sched_lock, MTX_SPIN);
159 mtx_unlock_spin(&sched_lock);
160 continue;
161
162 case SMTX:
163 case SSLEEP:
164 case SSTOP:
165 if (p->p_sflag & PS_INMEM) {
166 if (p->p_priority <= PZERO)
167 totalp->t_dw++;
168 else if (p->p_slptime < maxslp)
169 totalp->t_sl++;
170 } else if (p->p_slptime < maxslp)
171 totalp->t_sw++;
172 if (p->p_slptime >= maxslp) {
160 continue;
161
162 case SMTX:
163 case SSLEEP:
164 case SSTOP:
165 if (p->p_sflag & PS_INMEM) {
166 if (p->p_priority <= PZERO)
167 totalp->t_dw++;
168 else if (p->p_slptime < maxslp)
169 totalp->t_sl++;
170 } else if (p->p_slptime < maxslp)
171 totalp->t_sw++;
172 if (p->p_slptime >= maxslp) {
173 mtx_exit(&sched_lock, MTX_SPIN);
173 mtx_unlock_spin(&sched_lock);
174 continue;
175 }
176 break;
177
178 case SWAIT:
179 totalp->t_sl++;
180 continue;
181
182 case SRUN:
183 case SIDL:
184 if (p->p_sflag & PS_INMEM)
185 totalp->t_rq++;
186 else
187 totalp->t_sw++;
188 if (p->p_stat == SIDL) {
174 continue;
175 }
176 break;
177
178 case SWAIT:
179 totalp->t_sl++;
180 continue;
181
182 case SRUN:
183 case SIDL:
184 if (p->p_sflag & PS_INMEM)
185 totalp->t_rq++;
186 else
187 totalp->t_sw++;
188 if (p->p_stat == SIDL) {
189 mtx_exit(&sched_lock, MTX_SPIN);
189 mtx_unlock_spin(&sched_lock);
190 continue;
191 }
192 break;
193 }
190 continue;
191 }
192 break;
193 }
194 mtx_exit(&sched_lock, MTX_SPIN);
194 mtx_unlock_spin(&sched_lock);
195 /*
196 * Note active objects.
197 */
198 paging = 0;
199 for (map = &p->p_vmspace->vm_map, entry = map->header.next;
200 entry != &map->header; entry = entry->next) {
201 if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) ||
202 entry->object.vm_object == NULL)

--- 158 unchanged lines hidden ---
195 /*
196 * Note active objects.
197 */
198 paging = 0;
199 for (map = &p->p_vmspace->vm_map, entry = map->header.next;
200 entry != &map->header; entry = entry->next) {
201 if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) ||
202 entry->object.vm_object == NULL)

--- 158 unchanged lines hidden ---