mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Add mibs to hold the number of forks since boot. New mibs are:
vm.stats.vm.v_forks vm.stats.vm.v_vforks vm.stats.vm.v_rforks vm.stats.vm.v_kthreads vm.stats.vm.v_forkpages vm.stats.vm.v_vforkpages vm.stats.vm.v_rforkpages vm.stats.vm.v_kthreadpages Submitted by: Paul Herman <pherman@frenchfries.net> Reviewed by: alfred
This commit is contained in:
parent
f2334c4082
commit
5d22597f3a
4 changed files with 50 additions and 0 deletions
|
|
@ -65,6 +65,7 @@
|
|||
#include <vm/vm_extern.h>
|
||||
#include <vm/vm_zone.h>
|
||||
|
||||
#include <sys/vmmeter.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
static MALLOC_DEFINE(M_ATFORK, "atfork", "atfork callback");
|
||||
|
|
@ -517,6 +518,20 @@ again:
|
|||
*/
|
||||
vm_fork(p1, p2, flags);
|
||||
|
||||
if (flags == (RFFDG | RFPROC)) {
|
||||
cnt.v_forks++;
|
||||
cnt.v_forkpages += p2->p_vmspace->vm_dsize + p2->p_vmspace->vm_ssize;
|
||||
} else if (flags == (RFFDG | RFPROC | RFPPWAIT | RFMEM)) {
|
||||
cnt.v_vforks++;
|
||||
cnt.v_vforkpages += p2->p_vmspace->vm_dsize + p2->p_vmspace->vm_ssize;
|
||||
} else if (p1 == &proc0) {
|
||||
cnt.v_kthreads++;
|
||||
cnt.v_kthreadpages += p2->p_vmspace->vm_dsize + p2->p_vmspace->vm_ssize;
|
||||
} else {
|
||||
cnt.v_rforks++;
|
||||
cnt.v_rforkpages += p2->p_vmspace->vm_dsize + p2->p_vmspace->vm_ssize;
|
||||
}
|
||||
|
||||
/*
|
||||
* Both processes are set up, now check if any loadable modules want
|
||||
* to adjust anything.
|
||||
|
|
|
|||
|
|
@ -92,6 +92,17 @@ struct vmmeter {
|
|||
u_int v_pageout_free_min; /* min number pages reserved for kernel */
|
||||
u_int v_interrupt_free_min; /* reserved number of pages for int code */
|
||||
u_int v_free_severe; /* severe depletion of pages below this pt */
|
||||
/*
|
||||
* Fork/vfork/rfork activity.
|
||||
*/
|
||||
u_int v_forks; /* number of fork() calls */
|
||||
u_int v_vforks; /* number of vfork() calls */
|
||||
u_int v_rforks; /* number of rfork() calls */
|
||||
u_int v_kthreads; /* number of fork() calls by kernel */
|
||||
u_int v_forkpages; /* number of VM pages affected by fork() */
|
||||
u_int v_vforkpages; /* number of VM pages affected by vfork() */
|
||||
u_int v_rforkpages; /* number of VM pages affected by rfork() */
|
||||
u_int v_kthreadpages; /* number of VM pages affected by fork() by kernel */
|
||||
};
|
||||
#ifdef _KERNEL
|
||||
|
||||
|
|
|
|||
|
|
@ -323,6 +323,22 @@ SYSCTL_UINT(_vm_stats_vm, OID_AUTO,
|
|||
v_interrupt_free_min, CTLFLAG_RD, &cnt.v_interrupt_free_min, 0, "");
|
||||
SYSCTL_INT(_vm_stats_misc, OID_AUTO,
|
||||
zero_page_count, CTLFLAG_RD, &vm_page_zero_count, 0, "");
|
||||
SYSCTL_UINT(_vm_stats_vm, OID_AUTO,
|
||||
v_forks, CTLFLAG_RD, &cnt.v_forks, 0, "Number of fork() calls");
|
||||
SYSCTL_UINT(_vm_stats_vm, OID_AUTO,
|
||||
v_vforks, CTLFLAG_RD, &cnt.v_vforks, 0, "Number of vfork() calls");
|
||||
SYSCTL_UINT(_vm_stats_vm, OID_AUTO,
|
||||
v_rforks, CTLFLAG_RD, &cnt.v_rforks, 0, "Number of rfork() calls");
|
||||
SYSCTL_UINT(_vm_stats_vm, OID_AUTO,
|
||||
v_kthreads, CTLFLAG_RD, &cnt.v_kthreads, 0, "Number of fork() calls by kernel");
|
||||
SYSCTL_UINT(_vm_stats_vm, OID_AUTO,
|
||||
v_forkpages, CTLFLAG_RD, &cnt.v_forkpages, 0, "VM pages affected by fork()");
|
||||
SYSCTL_UINT(_vm_stats_vm, OID_AUTO,
|
||||
v_vforkpages, CTLFLAG_RD, &cnt.v_vforkpages, 0, "VM pages affected by vfork()");
|
||||
SYSCTL_UINT(_vm_stats_vm, OID_AUTO,
|
||||
v_rforkpages, CTLFLAG_RD, &cnt.v_rforkpages, 0, "VM pages affected by rfork()");
|
||||
SYSCTL_UINT(_vm_stats_vm, OID_AUTO,
|
||||
v_kthreadpages, CTLFLAG_RD, &cnt.v_kthreadpages, 0, "VM pages affected by fork() by kernel");
|
||||
#if 0
|
||||
SYSCTL_INT(_vm_stats_misc, OID_AUTO,
|
||||
page_mask, CTLFLAG_RD, &page_mask, 0, "");
|
||||
|
|
|
|||
|
|
@ -600,6 +600,10 @@ dosum()
|
|||
(void)printf("%9u software interrupts\n", sum.v_soft);
|
||||
(void)printf("%9u traps\n", sum.v_trap);
|
||||
(void)printf("%9u system calls\n", sum.v_syscall);
|
||||
(void)printf("%9u kernel threads created\n", sum.v_kthreads);
|
||||
(void)printf("%9u fork() calls\n", sum.v_forks);
|
||||
(void)printf("%9u vfork() calls\n", sum.v_vforks);
|
||||
(void)printf("%9u rfork() calls\n", sum.v_rforks);
|
||||
(void)printf("%9u swap pager pageins\n", sum.v_swapin);
|
||||
(void)printf("%9u swap pager pages paged in\n", sum.v_swappgsin);
|
||||
(void)printf("%9u swap pager pageouts\n", sum.v_swapout);
|
||||
|
|
@ -617,6 +621,10 @@ dosum()
|
|||
(void)printf("%9u zero fill pages prezeroed\n", sum.v_ozfod);
|
||||
(void)printf("%9u intransit blocking page faults\n", sum.v_intrans);
|
||||
(void)printf("%9u total VM faults taken\n", sum.v_vm_faults);
|
||||
(void)printf("%9u pages affected by kernel thread creation\n", sum.v_kthreadpages);
|
||||
(void)printf("%9u pages affected by fork()\n", sum.v_forkpages);
|
||||
(void)printf("%9u pages affected by vfork()\n", sum.v_vforkpages);
|
||||
(void)printf("%9u pages affected by rfork()\n", sum.v_rforkpages);
|
||||
(void)printf("%9u pages freed\n", sum.v_tfree);
|
||||
(void)printf("%9u pages freed by daemon\n", sum.v_dfree);
|
||||
(void)printf("%9u pages freed by exiting processes\n", sum.v_pfree);
|
||||
|
|
|
|||
Loading…
Reference in a new issue