Date: Sun, 20 Aug 2000 21:33:46 +0200 From: Willem Brown <willem@brwn.org> To: Chris Fedde <chris@fedde.littleton.co.us> Cc: questions@freebsd.org Subject: Re: getrusage not accumulating ru_utime? Message-ID: <20000820213346.F66585@snoopy.brwn.org> 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 References: <200008201906.e7KJ6O266296@fedde.littleton.co.us>
index | next in thread | previous in thread | raw e-mail
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 <stdio.h>
> #include <sys/times.h>
> #include <errno.h>
>
> #include <sys/types.h>
> #include <sys/time.h>
> #include <sys/resource.h>
> #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
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000820213346.F66585>
