The times
function returns more detailed information about elapsed processor time in a struct tms
object. You should include the header file `sys/times.h' to use this facility.
tms
structure is used to return information about process times. It contains at least the following members:
clock_t tms_utime
clock_t tms_stime
clock_t tms_cutime
tms_utime
values and the tms_cutime
values of all terminated child processes of the calling process, whose status has been reported to the parent process by wait
or waitpid
; see Process Completion. In other words, it represents the total CPU time used in executing the instructions of all the terminated child processes of the calling process, excluding child processes which have not yet been reported by wait
or waitpid
.
clock_t tms_cstime
tms_cutime
, but represents the total CPU time used by the system on behalf of all the terminated child processes of the calling process. All of the times are given in clock ticks. These are absolute values; in a newly created process, they are all zero. See Creating a Process.
times
function stores the processor time information for the calling process in buffer.
The return value is the same as the value of clock()
: the elapsed real time relative to an arbitrary base. The base is a constant within a particular process, and typically represents the time since system start-up. A value of (clock_t)(-1)
is returned to indicate failure.
Portability Note: The clock
function described in Basic CPU Time, is specified by the ANSI C standard. The times
function is a feature of POSIX.1. In the GNU system, the value returned by the clock
function is equivalent to the sum of the tms_utime
and tms_stime
fields returned by times
.