times - get process and waited-for child process times
#include <sys/times.h> clock_t times(struct tms *buffer);
The times() function fills the tms structure pointed to by buffer with time-accounting information. The structure tms is defined in <sys/times.h>.All times are measured in terms of the number of clock ticks used.
The times of a terminated child process are included in the tms_cutime and tms_cstime elements of the parent when wait() or waitpid() returns the process ID of this terminated child. If a child process has not waited for its children, their times will not be included in its times.
- The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process.
- The tms_stime structure member is the CPU time charged for execution by the system on behalf of the calling process.
- The tms_cutime structure member is the sum of the tms_utime and tms_cutime times of the child processes.
- The tms_cstime structure member is the sum of the tms_stime and tms_cstime times of the child processes.
Upon successful completion, times() returns the elapsed real time, in clock ticks, since an arbitrary point in the past (for example, system start-up time). This point does not change from one invocation of times() within the process to another. The return value may overflow the possible range of type clock_t. If times() fails, (clock_t)-1 is returned and errno is set to indicate the error.
No errors are defined.
None.
Applications should use to determine the number of clock ticks per second as it may vary from system to system.
None.
exec, fork(), sysconf(), time(), wait(), <sys/times.h>.
Derived from Issue 1 of the SVID.