User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666
Hello,
I've been trying to trace back an issue with the perl module
BSD::Resource not displaying memory information for processes. I believe
I've traced it back to the getrusage call provided via sys/resource.h.
I've got a simple sample program (below) that shows values for time and
memory use on a FreeBSD system, but on Mac OS X 10.5, I get the two time
values and zeros for the memory values.
Does anyone have any ideas why the values aren't coming back? Should I
file a bug report?
Is there a better way to get memory usage information in a program?
Thanks for any feedback.
Jim
#include <stdio.h>
#include <sys/resource.h>
main()
{
struct rusage ru;
printf("starting\n");
int i;
int a[1000000];
for (i = 0; i <= 1000000; i = i + 1){
if ( i % 100 == 0 )
printf("%d",i);
a[i] = i;
}
int c;
c = 1;
printf("\n\nGive me an integer to keep running:");
while ( (scanf("%d", &c)) == 1 ){
getrusage(0, &ru);
printf("\n\n");
printf("%d\n",ru.ru_utime.tv_usec);
printf("%d\n",ru.ru_stime.tv_usec);
printf("%ld\n",ru.ru_maxrss);
printf("%ld\n",ru.ru_ixrss);
printf("%ld\n",ru.ru_idrss);
printf("\n\nGive me an integer to keep running:");
}
printf("done\n");
return 0;
}
--
Jim Brandt
Administrative Computing Services
University at Buffalo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden