From owner-freebsd-questions Sun Aug 20 12:34: 1 2000 Delivered-To: freebsd-questions@freebsd.org Received: from snoopy.brwn.org (intgw1.brwn.org [196.28.127.66]) by hub.freebsd.org (Postfix) with ESMTP id 1232A37B43C for ; Sun, 20 Aug 2000 12:33:55 -0700 (PDT) Received: by snoopy.brwn.org (Postfix, from userid 1001) id 104E01D9D; Sun, 20 Aug 2000 21:33:46 +0200 (SAST) Date: Sun, 20 Aug 2000 21:33:46 +0200 From: Willem Brown To: Chris Fedde Cc: questions@freebsd.org Subject: Re: getrusage not accumulating ru_utime? Message-ID: <20000820213346.F66585@snoopy.brwn.org> References: <200008201906.e7KJ6O266296@fedde.littleton.co.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <200008201906.e7KJ6O266296@fedde.littleton.co.us>; from chris@fedde.littleton.co.us on Sun, Aug 20, 2000 at 01:06:24PM -0600 X-Public-Key: http://willem.brwn.org/pubkey.txt X-Chat-Server: http://chat.brwn.org/ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, I compiled and ran the code but changed 1000 to 10000 in the for loop. I noticed that when ru_stime reached 22002 it stopped counting and ru_utime started counting. ru_utime: 0.000000 ru_stime: 0.021813 ***************************************** ru_utime: 0.000000 ru_stime: 0.022002 ***************************************** ru_utime: 0.000200 ru_stime: 0.022002 ***************************************** ru_utime: 0.000393 ru_stime: 0.022002 I don't know the first thing about getrusage but maybe it will mean something to someone else. On Sun, Aug 20, 2000 at 01:06:24PM -0600, Chris Fedde wrote: > The code below does not report accumulation of ru_utime on my > 4.1-STABLE system. When I test it on other (4.0-RELEASE) systems > I have access to it behaves as I would expect it to. Any one have > any idea what is going on? This problem has been happening for me > since tag=RELENG_4 became 4.1-STABLE. > > $ uname -a > FreeBSD fedde.littleton.co.us 4.1-STABLE FreeBSD 4.1-STABLE #0: > Sat Aug 19 22:22:02 MDT 2000 > root@fedde.littleton.co.us:/home/usr.obj/home/usr.src/sys/FEDDE i386 > > thanks > chris > > -----------------------------------cut-here--------------------------------- > /* > * print the values returned by getrusage(2) > */ > > #include > #include > #include > > #include > #include > #include > #define RUSAGE_SELF 0 > #define RUSAGE_CHILDREN -1 > > struct rusage ru; > > int > main() { > > int i; > > while (1) { > float f = 3.14159; > > if (getrusage(RUSAGE_SELF, &ru) == -1){ > fprintf(stderr, "getrusage failed: %s\n", strerror(errno)); > exit(1); > } > > printf("*****************************************\n"); > printf("ru_utime: %d.%06d\n", ru.ru_utime.tv_sec, ru.ru_utime.tv_usec); > printf("ru_stime: %d.%06d\n", ru.ru_stime.tv_sec, ru.ru_stime.tv_usec); > > for (i=0; i< 1000; i++) > { > f = f*f; > } > > sleep(1); > } > } > -----------------------------------cut-here--------------------------------- > > -- > Chris Fedde > 303 773 9134 > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > Best Regards Willem Brown -- /* =============================================================== */ /* Linux, FreeBSD, NetBSD, OpenBSD. The choice is yours. */ /* =============================================================== */ It takes longer to glue a vase together than to break one. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message