Solved

system call -rusage

Posted on 2009-05-07
2
261 Views
Last Modified: 2012-05-06
hi,

could anyone pls help?i am using getrusage to get the max memory use and it is returning o..
this is the code:

      struct rusage usage;
      getrusage (RUSAGE_SELF, &usage);
      fprintf(stderr,"Memory Usage : %ld",usage.ru_maxrss);
thanks a miilion.
0
Comment
Question by:zizi21
2 Comments
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 500 total points
ID: 24332486
ru_maxrss and other members are not implemented on Linux.

From the man page:

      The above struct was taken from 4.3BSD Reno.  Not all fields are meaningful under Linux.  In linux 2.4 only the
       fields  ru_utime,  ru_stime,  ru_minflt, and ru_majflt are maintained.  Since Linux 2.6, ru_nvcsw and ru_nivcsw
       are also maintained.
0
 

Author Closing Comment

by:zizi21
ID: 31579282
Thanks a million
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question