site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Hi! Probably I'm doing something wrong, but what? Here is my call to getrusage: #include <stdio.h> #include <sys/time.h> #include <sys/resource.h> int main(int argc, const char *argv[]) { struct rusage u; int err = getrusage(RUSAGE_SELF, &u); return 0; } Any ideas? Thanks! Mike -- Mike Fischer Softwareentwicklung, EDV-Beratung Schulung, Vertrieb Web: <http://homepage.mac.com/mike_fischer/index.html> Note: I read this list in digest mode! Send me a private copy for faster responses. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... For some reason I can't seem to get getrusage(2) to work the way I expect it to under 10.4.11 on a PPC G5 machine (haven't tested on other machines). I expected the memory related fields to show values other than 0 which more or less correlate with the actual memory usage of the application. But what I am seeing is values of 0 only in each of these fields (ru_maxrss, ru_ixrss, ru_idrss, ru_isrss). if (0 == err) { double ut = u.ru_utime.tv_sec + u.ru_utime.tv_usec / 1000000.0; double st = u.ru_stime.tv_sec + u.ru_stime.tv_usec / 1000000.0; printf("ru_maxrss:0x%08x, ru_ixrss:0x%08x, ru_idrss:0x%08x, ru_isrss:0x%08x, user:%f s, system:%f s\n", u.ru_maxrss, u.ru_ixrss, u.ru_idrss, u.ru_isrss, ut, st); } else { printf("ERROR: getrusage() returned:%d\n", err); } Compiled as a standard command line tool using Xcode 2.4.1 it outputs something like this: ru_maxrss:0x00000000, ru_ixrss:0x00000000, ru_idrss:0x00000000, ru_isrss:0x00000000, user:0.129729 s, system:0.031769 s If I call this in a loop which also allocates and writes to some memory I see the user and system times increase but the other values stay at 0. This email sent to site_archiver@lists.apple.com
participants (1)
-
Mike Fischer