From owner-freebsd-current Mon Jan 15 12:26:33 2001 Delivered-To: freebsd-current@freebsd.org Received: from peace.mahoroba.org (peace.calm.imasy.or.jp [202.227.26.34]) by hub.freebsd.org (Postfix) with ESMTP id 5E2B037B402 for ; Mon, 15 Jan 2001 12:26:14 -0800 (PST) Received: from localhost (IDENT:oPV4SHMyEid7yJnTi97bp0+23eIWIPQlC4dNNYHXajpeyVu2cTFa48BczCOjXaYv@localhost [::1]) (authenticated) by peace.mahoroba.org (8.11.2/8.11.2/peace) with ESMTP/inet6 id f0FKJOd01215; Tue, 16 Jan 2001 05:19:25 +0900 (JST) (envelope-from ume@FreeBSD.org) Date: Tue, 16 Jan 2001 05:19:21 +0900 (JST) Message-Id: <20010116.051921.41625345.ume@FreeBSD.org> To: pherman@frenchfries.net Cc: current@FreeBSD.ORG Subject: Re: number of processes forked since boot From: Hajimu UMEMOTO In-Reply-To: References: <20010116.043828.97301753.ume@FreeBSD.org> X-Mailer: Mew version 1.95b97 on Emacs 20.7 / Mule 4.0 =?iso-2022-jp?B?KBskQjJWMWMbKEIp?= X-PGP-Public-Key: http://www.imasy.org/~ume/publickey.asc X-PGP-Fingerprint: 6B 0C 53 FC 5D D0 37 91 05 D0 B3 EF 36 9B 6A BC X-URL: http://www.imasy.org/~ume/ X-OS: FreeBSD 5.0-CURRENT Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >>>>> On Mon, 15 Jan 2001 21:07:08 +0100 (CET) >>>>> Paul Herman 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