#define RUSAGE_SELF 1 #define RUSAGE_CHILDREN 2 struct rusage { struct timeval ru_utime; // user CPU time used. struct timeval ru_stime; // system CPU time used. }; int getusage(int who, struct rusage *usage);
This syscall gets the use of several resources by a process.
Unlike what POSIX mandates, this syscall will always need remaining to
be a valid structure. clock_id takes the same value as clock.
Due to implementation details, for now, system time does include waiting time, but given this syscall’s information is merely advisory, it may be changed later.
who establishes who to request the information for, it can be one of:
RUSAGE_SELFGet information for the callee process.
RUSAGE_CHILDRENGet information for all of the children processes.
The syscall returns 0 on success or -1 on failure, with the
following errno:
EFAULTusage point to non accessible memory.
EINVALwho was not valid.