![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
| getrusage | 
| Portability: | UNIX compatible | 
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| USAGE NOTES | 
| SYNOPSIS | 
#include <sys/resource.h>
int getrusage(int type, 
              struct rusage *info);
| DESCRIPTION | 
The getrusage function returns
resource usage information for the calling process, or for terminated child
processes of the calling process.
The type argument is a symbolic constant
which specifies the processes for which resource information is wanted. The
permissible values are: 
RUSAGE_SELF | 
the current process | 
RUSAGE_CHILDREN | 
terminated child processes | 
Note:   If RUSAGE_CHILDREN is
specified, information is returned only for child processes for which the
parent has waited.  ![[cautionend]](../common/images/cautend.gif)
The info argument specifies a pointer
to an rusage structure in which resource usage
information is to be stored. The rusage structure
contains two fields: 
ru_utime - the user time consumed
by the process(es)
ru_stime - the system time consumed
by the process(es)
The ru_utime and ru_stime fields both have type
struct timeval, which allows a time value to be specified to an accuracy
of a microsecond. The structure has two fields: 
tv_sec - the number of seconds
used
tv_usec - the number of microseconds
used
| RETURN VALUE | 
getrusage returns 0 if successful, or -1 if
unsuccessful.
| USAGE NOTES | 
The getrusage function
can only be used with MVS 5.2.2 or a later release.
![]() Chapter Contents  | 
![]() Previous  | 
![]() Next  | 
![]() Top of Page  | 
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.