PEP 418: Fill "Include suspend" column of all tables

This commit is contained in:
Victor Stinner 2012-04-14 02:08:16 +02:00
parent d78474c6f6
commit 58bb56489d
1 changed files with 49 additions and 41 deletions

View File

@ -160,14 +160,11 @@ On Windows, ``QueryPerformanceCounter()`` is not used even though it
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 @@ Glossary
: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 @@ Monotonic clocks
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 @@ similar to CLOCK_MONOTONIC, less precise but faster.
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 @@ On Solaris, gethrtime() is the same as clock_gettime(CLOCK_MONOTONIC).
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 @@ Process time
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 @@ Python source code includes a portable library to get the process time (CPU
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 @@ Thread time
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 @@ CLOCK_THREAD_CPUTIME_ID Linux 3.2 1 ns 6
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() is not monotonic.
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
=================================