Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Aug 2000 13:06:24 -0600
From:      Chris Fedde <chris@fedde.littleton.co.us>
To:        questions@freebsd.org
Subject:   getrusage not accumulating ru_utime?
Message-ID:  <200008201906.e7KJ6O266296@fedde.littleton.co.us>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008201906.e7KJ6O266296>