vm_meter.c (144635) | vm_meter.c (144970) |
---|---|
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 --- 16 unchanged lines hidden (view full) --- 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 * @(#)vm_meter.c 8.4 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> | 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 --- 16 unchanged lines hidden (view full) --- 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 * @(#)vm_meter.c 8.4 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/vm/vm_meter.c 144635 2005-04-04 20:59:02Z jhb $"); | 33__FBSDID("$FreeBSD: head/sys/vm/vm_meter.c 144970 2005-04-12 23:15:28Z jhb $"); |
34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/lock.h> 39#include <sys/mutex.h> 40#include <sys/proc.h> 41#include <sys/resource.h> --- 208 unchanged lines hidden (view full) --- 250 * statistics, such as v_free_reserved, are left in the global 251 * structure. 252 * 253 * (sysctl_oid *oidp, void *arg1, int arg2, struct sysctl_req *req) 254 */ 255static int 256vcnt(SYSCTL_HANDLER_ARGS) 257{ | 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/lock.h> 39#include <sys/mutex.h> 40#include <sys/proc.h> 41#include <sys/resource.h> --- 208 unchanged lines hidden (view full) --- 250 * statistics, such as v_free_reserved, are left in the global 251 * structure. 252 * 253 * (sysctl_oid *oidp, void *arg1, int arg2, struct sysctl_req *req) 254 */ 255static int 256vcnt(SYSCTL_HANDLER_ARGS) 257{ |
258 int error = 0; | |
259 int count = *(int *)arg1; | 258 int count = *(int *)arg1; |
259 int offset = (char *)arg1 - (char *)&cnt; |
|
260#ifdef SMP 261 int i; | 260#ifdef SMP 261 int i; |
262 int offset = (char *)arg1 - (char *)&cnt; | |
263 264 for (i = 0; i < mp_ncpus; ++i) { 265 struct pcpu *pcpu = pcpu_find(i); 266 count += *(int *)((char *)&pcpu->pc_cnt + offset); 267 } 268#else | 262 263 for (i = 0; i < mp_ncpus; ++i) { 264 struct pcpu *pcpu = pcpu_find(i); 265 count += *(int *)((char *)&pcpu->pc_cnt + offset); 266 } 267#else |
269 int offset = (char *)arg1 - (char *)&cnt; | |
270 count += *(int *)((char *)PCPU_PTR(cnt) + offset); 271#endif | 268 count += *(int *)((char *)PCPU_PTR(cnt) + offset); 269#endif |
272 error = SYSCTL_OUT(req, &count, sizeof(int)); 273 return(error); | 270 return (SYSCTL_OUT(req, &count, sizeof(int))); |
274} 275 276SYSCTL_PROC(_vm, VM_TOTAL, vmtotal, CTLTYPE_OPAQUE|CTLFLAG_RD, 277 0, sizeof(struct vmtotal), vmtotal, "S,vmtotal", 278 "System virtual memory statistics"); 279SYSCTL_NODE(_vm, OID_AUTO, stats, CTLFLAG_RW, 0, "VM meter stats"); 280static SYSCTL_NODE(_vm_stats, OID_AUTO, sys, CTLFLAG_RW, 0, 281 "VM meter sys stats"); --- 113 unchanged lines hidden --- | 271} 272 273SYSCTL_PROC(_vm, VM_TOTAL, vmtotal, CTLTYPE_OPAQUE|CTLFLAG_RD, 274 0, sizeof(struct vmtotal), vmtotal, "S,vmtotal", 275 "System virtual memory statistics"); 276SYSCTL_NODE(_vm, OID_AUTO, stats, CTLFLAG_RW, 0, "VM meter stats"); 277static SYSCTL_NODE(_vm_stats, OID_AUTO, sys, CTLFLAG_RW, 0, 278 "VM meter sys stats"); --- 113 unchanged lines hidden --- |