PEP 418: Add info about sleep/suspend

This commit is contained in:
Victor Stinner 2012-04-11 00:42:54 +02:00
parent fef248a199
commit 6b47f7b960
1 changed files with 29 additions and 12 deletions

View File

@ -307,18 +307,18 @@ Operating system clocks
Monotonic clocks
----------------
========================= =============== ================ ====================
Name Resolution Adjusted by NTP? Action on suspend
========================= =============== ================ ====================
CLOCK_MONOTONIC_RAW 1 ns No Stopped
gethrtime 1 ns No Not stopped
CLOCK_HIGHRES 1 ns No ?
CLOCK_MONOTONIC 1 ns Slewed on Linux Stopped on Linux
mach_absolute_time() 1 ns No ?
QueryPerformanceCounter() \- No Accuracy issue
GetTickCount[64]() 1 ms No Include suspend time
timeGetTime() 1 ms No ?
========================= =============== ================ ====================
========================= ========== =============== ============= ===============
Name Resolution Adjusted Include sleep Include suspend
========================= ========== =============== ============= ===============
gethrtime 1 ns No Yes Yes
CLOCK_HIGHRES 1 ns No Yes ?
CLOCK_MONOTONIC 1 ns Slewed on Linux Yes No
CLOCK_MONOTONIC_RAW 1 ns No Yes No
mach_absolute_time() 1 ns No ? ?
QueryPerformanceCounter() \- No Yes ?
GetTickCount[64]() 1 ms No Yes Yes
timeGetTime() 1 ms No Yes ?
========================= ========== =============== ============= ===============
Examples of clock accuracy on x86_64:
@ -515,6 +515,9 @@ The return type of timeGetTime() is a 32-bit unsigned integer. As
GetTickCount(), timeGetTime() rolls over after 2^32 milliseconds (49.7
days).
The elapsed time retrieved by timeGetTime() includes time the system spends in
sleep.
The default precision of the timeGetTime function can be five
milliseconds or more, depending on the machine.
@ -805,6 +808,8 @@ Sleep, suspend and monotonic time
Linux
-----
sleep() is not affected by system clock update.
On Linux, CLOCK_MONOTONIC and CLOCK_MONOTONIC_RAW includes time the system
spends in sleep; but it does not include time spent in hibernation (ACPI S3
mode). If the system clock jumps backward, CLOCK_MONOTONIC and
@ -815,6 +820,18 @@ CLOCK_BOOTTIME is idential to CLOCK_MONOTONIC, except it also includes any time
spent in suspend. Read also `Waking systems from suspend
<http://lwn.net/Articles/429925/>`_ (March, 2011).
Other operating systems
-----------------------
On Windows, GetTickCount() and GetTickCount64() include time the system
spends in sleep; sleep() is not affected by system clock update.
On FreeBSD 8, CLOCK_MONOTONIC include time the system spends in sleep; sleep()
is not affected by system clock update.
On OpenIndiana, CLOCK_MONOTONIC include time the system spends in sleep;
sleep() is not affected by system clock update.
Sleeping
========