[Python-checkins] peps: PEP 418: Fill "Include suspend" column of all tables

victor.stinner python-checkins at python.org
Sat Apr 14 02:09:01 CEST 2012


http://hg.python.org/peps/rev/4836feae4d4c
changeset:   4246:4836feae4d4c
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Apr 14 02:08:16 2012 +0200
summary:
  PEP 418: Fill "Include suspend" column of all tables

files:
  pep-0418.txt |  90 +++++++++++++++++++++------------------
  1 files changed, 49 insertions(+), 41 deletions(-)


diff --git a/pep-0418.txt b/pep-0418.txt
--- a/pep-0418.txt
+++ b/pep-0418.txt
@@ -160,14 +160,11 @@
 has a better precision than ``GetTickCount()``.  It is not reliable
 and has too many issues.
 
-.. note::
-
-   ``time.monotonic()`` detects ``GetTickCount()`` integer overflow
-   (32 bits, roll-over after 49.7 days): it increases a delta by 2\
-   :sup:`32` each time than an overflow is detected.  The delta is
-   stored in the process-local state and so the value of
-   ``time.monotonic()`` may be different in two Python processes
-   running for more than 49 days.
+``time.monotonic()`` detects ``GetTickCount()`` integer overflow (32 bits,
+roll-over after 49.7 days): it increases a delta by 2\ :sup:`32` each time
+than an overflow is detected.  The delta is stored in the process-local
+state and so the value of ``time.monotonic()`` may be different in two
+Python processes running for more than 49 days.
 
 
 time.perf_counter()
@@ -391,7 +388,8 @@
 :Accuracy:
    Is the answer correct?  Any clock will eventually <drift>; if a
    clock is intended to match <Civil Time>, it will need to be
-   <adjusted> back to the "true" time.
+   <adjusted> back to the "true" time. See also `Accuracy and precision
+   <http://en.wikipedia.org/wiki/Accuracy_and_precision>`_.
 
 :Adjusted:
    Resetting a clock to the correct time.  This may be done either
@@ -709,7 +707,7 @@
 Name                       Resolution  Adjusted         Include sleep  Include suspend
 =========================  ==========  ===============  =============  ===============
 gethrtime()                1 ns        No               Yes            Yes
-CLOCK_HIGHRES              1 ns        No               Yes            ?
+CLOCK_HIGHRES              1 ns        No               Yes            Yes
 CLOCK_MONOTONIC            1 ns        Slewed on Linux  Yes            No
 CLOCK_MONOTONIC_COARSE     1 ns        Slewed on Linux  Yes            No
 CLOCK_MONOTONIC_RAW        1 ns        No               Yes            No
@@ -807,10 +805,6 @@
 clock, even if the standard C library supports it.  For example,
 CLOCK_MONOTONIC_RAW requires a kernel version 2.6.28 or later.
 
-.. note::
-
-   ``clock_gettime()`` requires to link the program against the rt
-   (real-time) library.
 
 Windows: QueryPerformanceCounter
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -963,16 +957,16 @@
 System time clocks
 ------------------
 
-========================= ===============  =============
-Name                      Resolution       Include sleep
-========================= ===============  =============
-CLOCK_REALTIME            1 ns             Yes
-CLOCK_REALTIME_COARSE     1 ns             Yes
-GetSystemTimeAsFileTime   100 ns           Yes
-gettimeofday()            1 µs             Yes
-ftime()                   1 ms             Yes
-time()                    1 sec            Yes
-========================= ===============  =============
+========================= ===============  =============  ===============
+Name                      Resolution       Include sleep  Include suspend
+========================= ===============  =============  ===============
+CLOCK_REALTIME            1 ns             Yes            Yes
+CLOCK_REALTIME_COARSE     1 ns             Yes            Yes
+GetSystemTimeAsFileTime   100 ns           Yes            Yes
+gettimeofday()            1 µs             Yes            Yes
+ftime()                   1 ms             Yes            Yes
+time()                    1 sec            Yes            Yes
+========================= ===============  =============  ===============
 
 Examples of clock precision on x86_64:
 
@@ -1025,15 +1019,15 @@
 The process time cannot be set.  It is not monotonic: the clocks stop
 while the process is idle.
 
-=========================  ==========  =============
-Name                       Resolution  Include sleep
-=========================  ==========  =============
-GetProcessTimes()              100 ns  No
-CLOCK_PROCESS_CPUTIME_ID         1 ns  No
-getrusage(RUSAGE_SELF)           1 µs  No
-times()                            \-  No
-clock()                            \-  No (*)
-=========================  ==========  =============
+=========================  ==========  =============  ===============
+Name                       Resolution  Include sleep  Include suspend
+=========================  ==========  =============  ===============
+GetProcessTimes()              100 ns  No             No
+CLOCK_PROCESS_CPUTIME_ID         1 ns  No             No
+getrusage(RUSAGE_SELF)           1 µs  No             No
+times()                            \-  No             No
+clock()                            \-  No (*)         No
+=========================  ==========  =============  ===============
 
 (*) On Windows, clock() does include time elapsed during a sleep. It does not
 on other operating systems.
@@ -1081,6 +1075,10 @@
 time): `Tools/pybench/systimes.py
 <http://hg.python.org/cpython/file/tip/Tools/pybench/systimes.py>`_.
 
+See also the `QueryProcessCycleTime() function
+<http://msdn.microsoft.com/en-us/library/windows/desktop/ms684929(v=vs.85).aspx>`_
+(sum of the cycle time of all threads).
+
 
 Thread time
 -----------
@@ -1088,12 +1086,12 @@
 The thread time cannot be set.  It is not monotonic: the clocks stop
 while the thread is idle.
 
-=========================  ==========
-Name                       Resolution
-=========================  ==========
-CLOCK_THREAD_CPUTIME_ID          1 ns
-GetThreadTimes()               100 ns
-=========================  ==========
+=========================  ==========  =============  ===============
+Name                       Resolution  Include sleep  Include suspend
+=========================  ==========  =============  ===============
+CLOCK_THREAD_CPUTIME_ID          1 ns  Yes            Epoch changes
+GetThreadTimes()               100 ns  No             ?
+=========================  ==========  =============  ===============
 
 Examples of clock precision on x86_64:
 
@@ -1105,16 +1103,22 @@
 GetThreadTimes()           Windows Seven               16 ms                16 ms
 =========================  ================  ===============  ===================
 
+CLOCK_THREAD_CPUTIME_ID returns a number of CPU cycles, not a number of
+seconds.
+
 
 Functions
 ^^^^^^^^^
 
 * Windows: GetThreadTimes(). The precision can be read using
-  GetSystemTimeAdjustment().
+  GetSystemTimeAdjustment(). `MSDN documentation of GetThreadTimes()
+  <http://msdn.microsoft.com/en-us/library/windows/desktop/ms683237(v=vs.85).aspx>`_.
 * clock_gettime(CLOCK_THREAD_CPUTIME_ID): Thread-specific CPU-time
   clock. The precision can be read using of clock_getres().
 
-See also pthread_getcpuclockid().
+See also the `QueryThreadCycleTime() function
+<http://msdn.microsoft.com/en-us/library/windows/desktop/ms684943(v=vs.85).aspx>`_
+(cycle time for the specified thread) and pthread_getcpuclockid().
 
 
 Windows: QueryUnbiasedInterruptTime
@@ -1130,6 +1134,10 @@
 
 QueryUnbiasedInterruptTime() was introduced in Windows 7.
 
+See also `QueryIdleProcessorCycleTime() function
+<http://msdn.microsoft.com/en-us/library/windows/desktop/ms684922(v=vs.85).aspx>`_
+(cycle time for the idle thread of each processor)
+
 
 Sleep, suspend and monotonic time
 =================================

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list