Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

times(3) [netbsd man page]

TIMES(3)						   BSD Library Functions Manual 						  TIMES(3)

NAME
times -- process times LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/times.h> clock_t times(struct tms *tp); DESCRIPTION
This interface is obsoleted by getrusage(2) and gettimeofday(2). The times() function returns the value of time in clock ticks since 0 hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal Time (UTC). The number of clock ticks per second may be determined by calling sysconf(3) with the _SC_CLK_TCK request. It is generally (but not always) between 60 and 1024. Note that at the common rate of 100 ticks per second on many NetBSD ports, and with a 32-bit unsigned clock_t, this value first wrapped in 1971. The times() call also fills in the structure pointed to by tp with time-accounting information. The tms structure is defined as follows: typedef struct { clock_t tms_utime; clock_t tms_stime; clock_t tms_cutime; clock_t tms_cstime; } The elements of this structure are defined as follows: tms_utime The CPU time charged for the execution of user instructions. tms_stime The CPU time charged for execution by the system on behalf of the process. tms_cutime The sum of the tms_utime s and tms_cutime s of the child processes. tms_cstime The sum of the tms_stimes and tms_cstimes of the child processes. All times are measured in clock ticks, as defined above. Note that at 100 ticks per second, and with a 32-bit unsigned clock_t, the values wrap after 497 days. The times of a terminated child process are included in the tms_cutime and tms_cstime elements of the parent when one of the wait(2) func- tions returns the process ID of the terminated child to the parent. If an error occurs, times() returns the value ((clock_t)-1), and sets errno to indicate the error. ERRORS
The times() function may fail and set the global variable errno for any of the errors specified for the library routines getrusage(2) and gettimeofday(2). SEE ALSO
time(1), getrusage(2), gettimeofday(2), wait(2), sysconf(3) STANDARDS
The times() function conforms to ISO/IEC 9945-1:1990 (``POSIX.1''). BSD
June 4, 1993 BSD

Check Out this Related Man Page

times(2)							   System Calls 							  times(2)

NAME
times - get process and child process times SYNOPSIS
#include <sys/times.h> #include <limits.h> clock_t times(struct tms *buffer); DESCRIPTION
The times() function fills the tms structure pointed to by buffer with time-accounting information. The tms structure, defined in <sys/times.h>, contains the following members: clock_t tms_utime; clock_t tms_stime; clock_t tms_cutime; clock_t tms_cstime; All times are reported in clock ticks. The specific value for a clock tick is defined by the variable CLK_TCK, found in the header <lim- its.h>. The times of a terminated child process are included in the tms_cutime and tms_cstime members of the parent when wait(3C) or waitpid(3C) 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 member is the CPU time used while executing instructions in the user space of the calling process. The tms_stime member is the CPU time used by the system on behalf of the calling process. The tms_cutime member is the sum of the tms_utime and the tms_cutime of the child processes. The tms_cstime member is the sum of the tms_stime and the tms_cstime of the child processes. RETURN VALUES
Upon successful completion, times() returns the elapsed real time, in clock ticks, since an arbitrary point in the past (for example, sys- tem 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. ERRORS
The times() function will fail if: EFAULT The buffer argument points to an illegal address. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
time(1), timex(1), exec(2), fork(2), time(2), waitid(2), wait(3C), waitpid(3C), attributes(5), standards(5) SunOS 5.11 14 May 1997 times(2)
Man Page