Linux and UNIX Man Pages

Test Your Knowledge in Computers #330
Difficulty: Easy
The first dual-core CPU was the Intel Pentium D.
True or False?
Linux & Unix Commands - Search Man Pages

clock(3c) [sunos man page]

clock(3C)						   Standard C Library Functions 						 clock(3C)

clock - report CPU time used SYNOPSIS
#include <time.h> clock_t clock(void); DESCRIPTION
The clock() function returns the amount of CPU time (in microseconds) used since the first call to clock() in the calling process. The time reported is the sum of the user and system times of the calling process and its terminated child processes for which it has executed the wait(3C) function, the pclose(3C) function, or the system(3C) function. RETURN VALUES
Dividing the value returned by clock() by the constant CLOCKS_PER_SEC, defined in the <time.h> header, will give the time in seconds. If the process time used is not available or cannot be represented, clock returns the value (clock_t) -1. USAGE
The value returned by clock() is defined in microseconds for compatibility with systems that have CPU clocks with much higher resolution. Because of this, the value returned will wrap around after accumulating only 2147 seconds of CPU time (about 36 minutes). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
times(2), popen(3C), system(3C), wait(3C), attributes(5), standards(5) SunOS 5.10 24 Jul 2002 clock(3C)

Check Out this Related Man Page

times(2)							   System Calls 							  times(2)

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)

Featured Tech Videos