TIMES(3V)

NAME
times - get process times

SYNOPSIS

#include <sys/types.h>
#include <sys/times.h>

int times(buffer)
struct tms *buffer;

SYSTEM V SYNOPSIS

clock_t times(buffer)
struct tms *buffer;

DESCRIPTION

This interface is obsoleted by getrusage(2).

times() returns time-accounting information for the current process and for the terminated child processes of the current process. All times are in 1/HZ seconds, where HZ is 60.

buffer points to the following structure:
    struct tms {
    	clock_t	tms_utime;		/* user time */
    	clock_t	tms_stime;		/* system time */
    	clock_t	tms_cutime;		/* user time, children */
    	clock_t	tms_cstime;		/* system time, children */
    };

This information comes from the calling process and each of its terminated child processes for which it has executed a wait(2V).

tms_utime is the CPU time used while executing instructions in the user space of the calling process.

tms_stime is the CPU time used by the system on behalf of the calling process.

tms_cutime is the sum of the tms_utimes and tms_cutimes of the child processes.

tms_cstime is the sum of the tms_stimes and tms_cstimes of the child processes.

RETURN VALUES

times() returns:

0   on success.

-1  on failure.

SYSTEM V RETURN VALUES

Upon successful completion, times() returns the elapsed real time, in 60ths of a second, since an arbitrary point in the past. This point does not change from one invocation of times() to another within the same process. On failure, times() returns (clock_t) -1.

SEE ALSO
time(1V), getrusage(2), wait(2V), time(3V)