Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_linux_programming thread: Process's information


Message #1 by murat.parlakisik@t... on Sun, 27 Aug 2000 17:52:45
Murat,

You can check process memory usage using the getrusage() function. The 
following text (reproduced from
http://www.delorie.com/gnu/docs/glibc/libc_308.html) gives more detail: 

*********************************************************************

Function: int getrusage (int processes, struct rusage *rusage) 
This function reports the usage totals for processes specified by 
processes, storing the information in *rusage.

In most systems, processes has only two valid values: 

RUSAGE_SELF 
Just the current process. 
RUSAGE_CHILDREN 
All child processes (direct and indirect) that have terminated already. 
In the GNU system, you can also inquire about a particular child process by 
specifying its process ID.

The return value of getrusage is zero for success, and -1 for failure. 

EINVAL 
The argument processes is not valid. 
One way of getting usage figures for a particular child process is with the 
function wait4, which returns totals for a child when it terminates. See 
section BSD Process Wait Functions.

***********************************************************************
Hope this helps,

Richard Hills
List Moderator
P2P
Wrox Press
richardhills@w...


On 08/29/00, "murat.parlakisik@t..." wrote:

Hi ,
I have some problem about process information. I can see process memory 
usage with "top" program.
I try to write some codes to check process memory usage.
Do you have any idea?

Thanks for all

  Return to Index