OSDN Git Service

(split) LDP: Update original to LDP v3.65
[linuxjm/LDP_man-pages.git] / original / man2 / clock_getres.2
index 10ecd18..10ecafe 100644 (file)
@@ -27,7 +27,7 @@
 .\" 2003-08-24 aeb, large parts rewritten
 .\" 2004-08-06 Christoph Lameter <clameter@sgi.com>, SMP note
 .\"
-.TH CLOCK_GETRES 2 2013-02-25 "" "Linux Programmer's Manual"
+.TH CLOCK_GETRES 2 2013-12-28 "" "Linux Programmer's Manual"
 .SH NAME
 clock_getres, clock_gettime, clock_settime \- clock and time functions
 .SH SYNOPSIS
@@ -171,10 +171,11 @@ without having to deal with the complications of
 which may have discontinuities if the time is changed using
 .BR settimeofday (2).
 .TP
-.B CLOCK_PROCESS_CPUTIME_ID
-High-resolution per-process timer from the CPU.
+.BR CLOCK_PROCESS_CPUTIME_ID " (since Linux 2.6.12)"
+Per-process CPU-time clock
+(measures CPU time consumed by all threads in the process).
 .TP
-.B CLOCK_THREAD_CPUTIME_ID
+.BR CLOCK_THREAD_CPUTIME_ID " (since Linux 2.6.12)"
 Thread-specific CPU-time clock.
 .SH RETURN VALUE
 .BR clock_gettime (),
@@ -201,6 +202,8 @@ specified is not supported on this system.
 .B EPERM
 .BR clock_settime ()
 does not have permission to set the clock indicated.
+.SH VERSIONS
+These system calls first appeared in Linux 2.6.
 .SH CONFORMING TO
 SUSv2, POSIX.1-2001.
 .SH AVAILABILITY
@@ -219,22 +222,23 @@ are available.
 (See also
 .BR sysconf (3).)
 .SH NOTES
-.SS Note for SMP systems
-The
+.SS Historical note for SMP systems
+Before Linux added kernel support for
 .B CLOCK_PROCESS_CPUTIME_ID
 and
-.B CLOCK_THREAD_CPUTIME_ID
-clocks are realized on many platforms using timers from the CPUs
+.BR CLOCK_THREAD_CPUTIME_ID ,
+glibc implemented these clocks on many platforms using timer
+registers from the CPUs
 (TSC on i386, AR.ITC on Itanium).
 These registers may differ between CPUs and as a consequence
 these clocks may return
 .B bogus results
 if a process is migrated to another CPU.
 .PP
-If the CPUs in an SMP system have different clock sources then
+If the CPUs in an SMP system have different clock sources, then
 there is no way to maintain a correlation between the timer registers since
 each CPU will run at a slightly different frequency.
-If that is the case then
+If that is the case, then
 .I clock_getcpuclockid(0)
 will return
 .B ENOENT
@@ -250,6 +254,15 @@ Glibc contains no provisions to deal with these offsets (unlike the Linux
 Kernel).
 Typically these offsets are small and therefore the effects may be
 negligible in most cases.
+
+Since glibc 2.4,
+the wrapper functions for the system calls described in this page avoid
+the abovementioned problems by employing the kernel implementation of
+.B CLOCK_PROCESS_CPUTIME_ID
+and
+.BR CLOCK_THREAD_CPUTIME_ID ,
+on systems that provide such an implementation
+(i.e., Linux 2.6.12 and later).
 .SH BUGS
 According to POSIX.1-2001, a process with "appropriate privileges" may set the
 .B CLOCK_PROCESS_CPUTIME_ID
@@ -272,3 +285,11 @@ On Linux, these clocks are not settable
 .BR pthread_getcpuclockid (3),
 .BR sysconf (3),
 .BR time (7)
+.SH COLOPHON
+This page is part of release 3.65 of the Linux
+.I man-pages
+project.
+A description of the project,
+and information about reporting bugs,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.