Date: Tue, 16 Jan 2001 05:19:21 +0900 (JST) From: Hajimu UMEMOTO <ume@FreeBSD.org> To: pherman@frenchfries.net Cc: current@FreeBSD.ORG Subject: Re: number of processes forked since boot Message-ID: <20010116.051921.41625345.ume@FreeBSD.org> In-Reply-To: <Pine.BSF.4.31.0101152058170.11142-100000@husten.security.at12.de> References: <20010116.043828.97301753.ume@FreeBSD.org> <Pine.BSF.4.31.0101152058170.11142-100000@husten.security.at12.de>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> On Mon, 15 Jan 2001 21:07:08 +0100 (CET) >>>>> Paul Herman <pherman@frenchfries.net> said: pherman> Yes, that's my read from the source. What I also like about it is pherman> that it counts [vr]forks to boot, plus vmpages affected by the fork. pherman> After I first saw this in OBSD I was really motivated to do just what pherman> you've done for FreeBSD, but never got around to it. I just moved nforks into vm_meter.c Here is a patch: Index: sys/kern/kern_fork.c diff -u sys/kern/kern_fork.c.orig sys/kern/kern_fork.c --- sys/kern/kern_fork.c.orig Fri Jan 12 02:46:53 2001 +++ sys/kern/kern_fork.c Tue Jan 16 04:53:18 2001 @@ -145,6 +145,7 @@ int nprocs = 1; /* process 0 */ static int nextpid = 0; +extern unsigned int nforks; /* * Random component to nextpid generation. We mix in a random factor to make @@ -277,6 +278,8 @@ } newproc->p_vmspace = NULL; + + nforks++; /* * Find an unused process ID. We remember a range of unused IDs Index: sys/vm/vm_meter.c diff -u sys/vm/vm_meter.c.orig sys/vm/vm_meter.c --- sys/vm/vm_meter.c.orig Fri Jan 12 02:48:48 2001 +++ sys/vm/vm_meter.c Tue Jan 16 04:51:49 2001 @@ -126,6 +126,10 @@ SYSCTL_UINT(_vm, OID_AUTO, v_free_severe, CTLFLAG_RW, &cnt.v_free_severe, 0, ""); +unsigned int nforks = 0; +SYSCTL_UINT(_vm, OID_AUTO, nforks, CTLFLAG_RD, &nforks, 0, + "number of fork()s since boot"); + SYSCTL_STRUCT(_vm, VM_LOADAVG, loadavg, CTLFLAG_RD, &averunnable, loadavg, "Machine loadaverage history"); pherman> If you like, I'll see if I can't come up with something pherman> similar. Shouldn't be too hard. I'll try that tonight. Please do it. pherman> The hardest part would be finding a spot on the systat(1) display to pherman> put it. :-) Exactly. -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@bisd.hitachi.co.jp ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010116.051921.41625345.ume>