Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_meter.c
Context not available. | |||||
} | } | ||||
/* | /* | ||||
* vcnt() - accumulate statistics from all cpus and the global cnt | * vm_meter_cnt() - accumulate statistics from all cpus and the global cnt | ||||
* structure. | * structure. | ||||
* | * | ||||
* The vmmeter structure is now per-cpu as well as global. Those | * The vmmeter structure is now per-cpu as well as global. Those | ||||
* statistics which can be kept on a per-cpu basis (to avoid cache | * statistics which can be kept on a per-cpu basis (to avoid cache | ||||
Context not available. | |||||
* stalls between cpus) can be moved to the per-cpu vmmeter. Remaining | * stalls between cpus) can be moved to the per-cpu vmmeter. Remaining | ||||
* statistics, such as v_free_reserved, are left in the global | * statistics, such as v_free_reserved, are left in the global | ||||
* structure. | * structure. | ||||
* | |||||
* (sysctl_oid *oidp, void *arg1, int arg2, struct sysctl_req *req) | |||||
*/ | */ | ||||
static int | u_int | ||||
vcnt(SYSCTL_HANDLER_ARGS) | vm_meter_cnt(size_t offset) | ||||
{ | { | ||||
int count = *(int *)arg1; | struct pcpu *pcpu; | ||||
int offset = (char *)arg1 - (char *)&vm_cnt; | u_int count; | ||||
int i; | int i; | ||||
count = *(u_int *)((char *)&vm_cnt + offset); | |||||
CPU_FOREACH(i) { | CPU_FOREACH(i) { | ||||
struct pcpu *pcpu = pcpu_find(i); | pcpu = pcpu_find(i); | ||||
count += *(int *)((char *)&pcpu->pc_cnt + offset); | count += *(u_int *)((char *)&pcpu->pc_cnt + offset); | ||||
} | } | ||||
return (SYSCTL_OUT(req, &count, sizeof(int))); | return (count); | ||||
} | } | ||||
static int | |||||
cnt_sysctl(SYSCTL_HANDLER_ARGS) | |||||
{ | |||||
u_int count; | |||||
count = vm_meter_cnt((char *)arg1 - (char *)&vm_cnt); | |||||
return (SYSCTL_OUT(req, &count, sizeof(count))); | |||||
} | |||||
SYSCTL_PROC(_vm, VM_TOTAL, vmtotal, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE, | SYSCTL_PROC(_vm, VM_TOTAL, vmtotal, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE, | ||||
0, sizeof(struct vmtotal), vmtotal, "S,vmtotal", | 0, sizeof(struct vmtotal), vmtotal, "S,vmtotal", | ||||
"System virtual memory statistics"); | "System virtual memory statistics"); | ||||
Context not available. | |||||
#define VM_STATS(parent, var, descr) \ | #define VM_STATS(parent, var, descr) \ | ||||
SYSCTL_PROC(parent, OID_AUTO, var, \ | SYSCTL_PROC(parent, OID_AUTO, var, \ | ||||
CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE, &vm_cnt.var, 0, vcnt, \ | CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE, &vm_cnt.var, 0, \ | ||||
"IU", descr) | cnt_sysctl, "IU", descr) | ||||
#define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) | #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) | ||||
#define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) | #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) | ||||
Context not available. | |||||
VM_STATS_VM(v_vnodepgsin, "Vnode pages paged in"); | VM_STATS_VM(v_vnodepgsin, "Vnode pages paged in"); | ||||
VM_STATS_VM(v_vnodepgsout, "Vnode pages paged out"); | VM_STATS_VM(v_vnodepgsout, "Vnode pages paged out"); | ||||
VM_STATS_VM(v_intrans, "In transit page faults"); | VM_STATS_VM(v_intrans, "In transit page faults"); | ||||
VM_STATS_VM(v_reactivated, "Pages reactivated from free list"); | VM_STATS_VM(v_reactivated, "Pages reactivated by pagedaemon"); | ||||
VM_STATS_VM(v_pdwakeups, "Pagedaemon wakeups"); | VM_STATS_VM(v_pdwakeups, "Pagedaemon wakeups"); | ||||
VM_STATS_VM(v_pdpages, "Pages analyzed by pagedaemon"); | VM_STATS_VM(v_pdpages, "Pages analyzed by pagedaemon"); | ||||
VM_STATS_VM(v_pdshortfalls, "Page reclamation shortfalls"); | |||||
VM_STATS_VM(v_tcached, "Total pages cached"); | VM_STATS_VM(v_tcached, "Total pages cached"); | ||||
VM_STATS_VM(v_dfree, "Pages freed by pagedaemon"); | VM_STATS_VM(v_dfree, "Pages freed by pagedaemon"); | ||||
VM_STATS_VM(v_pfree, "Pages freed by exiting processes"); | VM_STATS_VM(v_pfree, "Pages freed by exiting processes"); | ||||
Context not available. | |||||
VM_STATS_VM(v_active_count, "Active pages"); | VM_STATS_VM(v_active_count, "Active pages"); | ||||
VM_STATS_VM(v_inactive_target, "Desired inactive pages"); | VM_STATS_VM(v_inactive_target, "Desired inactive pages"); | ||||
VM_STATS_VM(v_inactive_count, "Inactive pages"); | VM_STATS_VM(v_inactive_count, "Inactive pages"); | ||||
VM_STATS_VM(v_laundry_count, "Pages eligible for laundering"); | |||||
VM_STATS_VM(v_cache_count, "Pages on cache queue"); | VM_STATS_VM(v_cache_count, "Pages on cache queue"); | ||||
VM_STATS_VM(v_pageout_free_min, "Min pages reserved for kernel"); | VM_STATS_VM(v_pageout_free_min, "Min pages reserved for kernel"); | ||||
VM_STATS_VM(v_interrupt_free_min, "Reserved pages for interrupt code"); | VM_STATS_VM(v_interrupt_free_min, "Reserved pages for interrupt code"); | ||||
Context not available. |