Go to the first, previous, next, last section, table of contents.


getrusage

Syntax

#include <sys/time.h>
#include <sys/resource.h>

int getrusage(int who, struct rusage *rusage);

Description

This function returns information about the running process. Currently, the only field that is computed is this:

struct rusage {
  struct timeval ru_utime;  /* total time used by process */
};

The remainder of the fields are set to zero.

The who parameter must be RUSAGE_SELF or RUSAGE_CHILDREN.

Return Value

Zero on success, nonzero on failure.

Portability

not ANSI, not POSIX

Example

struct rusage r;
getrusage(RUSAGE_SELF, &r);


Go to the first, previous, next, last section, table of contents.