PEP 418: Replace "Resolution" column with "C Resolution", and "Precision" with
"OS Resolution" Document also these two columns.
This commit is contained in:
parent
464a098160
commit
94fb568222
279
pep-0418.txt
279
pep-0418.txt
|
@ -912,43 +912,48 @@ Operating system time functions
|
|||
Monotonic Clocks
|
||||
----------------
|
||||
|
||||
========================= ========== =============== ============= ===============
|
||||
Name Resolution Adjusted Include sleep Include suspend
|
||||
========================= ========== =============== ============= ===============
|
||||
gethrtime() 1 ns No Yes 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
|
||||
CLOCK_BOOTTIME 1 ns ? Yes Yes
|
||||
CLOCK_UPTIME 1 ns No Yes ?
|
||||
mach_absolute_time() 1 ns No Yes No
|
||||
QueryPerformanceCounter() \- No Yes ?
|
||||
GetTickCount[64]() 1 ms No Yes Yes
|
||||
timeGetTime() 1 ms No Yes ?
|
||||
========================= ========== =============== ============= ===============
|
||||
========================= ============ =============== ============= ===============
|
||||
Name C Resolution Adjusted Include Sleep Include Suspend
|
||||
========================= ============ =============== ============= ===============
|
||||
gethrtime() 1 ns No Yes 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
|
||||
CLOCK_BOOTTIME 1 ns ? Yes Yes
|
||||
CLOCK_UPTIME 1 ns No Yes ?
|
||||
mach_absolute_time() 1 ns No Yes No
|
||||
QueryPerformanceCounter() \- No Yes ?
|
||||
GetTickCount[64]() 1 ms No Yes Yes
|
||||
timeGetTime() 1 ms No Yes ?
|
||||
========================= ============ =============== ============= ===============
|
||||
|
||||
The "C Resolution" column is the resolution of the underlying C
|
||||
structure.
|
||||
|
||||
Examples of clock precision on x86_64:
|
||||
|
||||
========================= ================ ========= =================
|
||||
Name Operating system Precision Python Resolution
|
||||
========================= ================ ========= =================
|
||||
QueryPerformanceCounter Windows Seven 10 ns 10 ns
|
||||
CLOCK_HIGHRES SunOS 5.11 2 ns 265 ns
|
||||
CLOCK_MONOTONIC Linux 3.0 1 ns 322 ns
|
||||
CLOCK_MONOTONIC_RAW Linux 3.3 1 ns 628 ns
|
||||
CLOCK_BOOTTIME Linux 3.3 1 ns 628 ns
|
||||
mach_absolute_time() Mac OS 10.6 1 ns 3 µs
|
||||
CLOCK_MONOTONIC FreeBSD 8.2 11 ns 5 µs
|
||||
CLOCK_MONOTONIC OpenBSD 5.0 10 ms 5 µs
|
||||
CLOCK_UPTIME FreeBSD 8.2 11 ns 6 µs
|
||||
CLOCK_MONOTONIC_COARSE Linux 3.3 1 ms 1 ms
|
||||
CLOCK_MONOTONIC_COARSE Linux 3.0 4 ms 4 ms
|
||||
GetTickCount64() Windows Seven 16 ms 15 ms
|
||||
========================= ================ ========= =================
|
||||
========================= ================ ============= =================
|
||||
Name Operating system OS Resolution Python Resolution
|
||||
========================= ================ ============= =================
|
||||
QueryPerformanceCounter Windows Seven 10 ns 10 ns
|
||||
CLOCK_HIGHRES SunOS 5.11 2 ns 265 ns
|
||||
CLOCK_MONOTONIC Linux 3.0 1 ns 322 ns
|
||||
CLOCK_MONOTONIC_RAW Linux 3.3 1 ns 628 ns
|
||||
CLOCK_BOOTTIME Linux 3.3 1 ns 628 ns
|
||||
mach_absolute_time() Mac OS 10.6 1 ns 3 µs
|
||||
CLOCK_MONOTONIC FreeBSD 8.2 11 ns 5 µs
|
||||
CLOCK_MONOTONIC OpenBSD 5.0 10 ms 5 µs
|
||||
CLOCK_UPTIME FreeBSD 8.2 11 ns 6 µs
|
||||
CLOCK_MONOTONIC_COARSE Linux 3.3 1 ms 1 ms
|
||||
CLOCK_MONOTONIC_COARSE Linux 3.0 4 ms 4 ms
|
||||
GetTickCount64() Windows Seven 16 ms 15 ms
|
||||
========================= ================ ============= =================
|
||||
|
||||
The "Python Resolution" column was filled using the
|
||||
`clock_resolution.py
|
||||
The "OS Resolution" is the resolution announced by the operating
|
||||
system.
|
||||
The "Python Resolution" is the smallest difference between two calls
|
||||
to the time function computed in Python using the `clock_resolution.py
|
||||
<http://hg.python.org/peps/file/tip/pep-0418/clock_resolution.py>`_
|
||||
program.
|
||||
|
||||
|
@ -1172,35 +1177,40 @@ On Solaris, gethrtime() is the same as clock_gettime(CLOCK_MONOTONIC).
|
|||
System Time
|
||||
-----------
|
||||
|
||||
========================= =============== ============= ===============
|
||||
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
|
||||
========================= =============== ============= ===============
|
||||
========================= ============ ============= ===============
|
||||
Name C 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
|
||||
========================= ============ ============= ===============
|
||||
|
||||
The "C Resolution" column is the resolution of the underlying C
|
||||
structure.
|
||||
|
||||
Examples of clock precision on x86_64:
|
||||
|
||||
========================= ================ ========= =================
|
||||
Name Operating system Precision Python Resolution
|
||||
========================= ================ ========= =================
|
||||
CLOCK_REALTIME SunOS 5.11 10 ms 238 ns
|
||||
CLOCK_REALTIME Linux 3.0 1 ns 238 ns
|
||||
gettimeofday() Mac OS 10.6 1 µs 4 µs
|
||||
CLOCK_REALTIME FreeBSD 8.2 11 ns 6 µs
|
||||
CLOCK_REALTIME OpenBSD 5.0 10 ms 5 µs
|
||||
CLOCK_REALTIME_COARSE Linux 3.3 1 ms 1 ms
|
||||
CLOCK_REALTIME_COARSE Linux 3.0 4 ms 4 ms
|
||||
GetSystemTimeAsFileTime() Windows Seven 16 ms 1 ms
|
||||
ftime() Windows Seven \- 1 ms
|
||||
========================= ================ ========= =================
|
||||
========================= ================ ============= =================
|
||||
Name Operating system OS Resolution Python Resolution
|
||||
========================= ================ ============= =================
|
||||
CLOCK_REALTIME SunOS 5.11 10 ms 238 ns
|
||||
CLOCK_REALTIME Linux 3.0 1 ns 238 ns
|
||||
gettimeofday() Mac OS 10.6 1 µs 4 µs
|
||||
CLOCK_REALTIME FreeBSD 8.2 11 ns 6 µs
|
||||
CLOCK_REALTIME OpenBSD 5.0 10 ms 5 µs
|
||||
CLOCK_REALTIME_COARSE Linux 3.3 1 ms 1 ms
|
||||
CLOCK_REALTIME_COARSE Linux 3.0 4 ms 4 ms
|
||||
GetSystemTimeAsFileTime() Windows Seven 16 ms 1 ms
|
||||
ftime() Windows Seven \- 1 ms
|
||||
========================= ================ ============= =================
|
||||
|
||||
The "Python Resolution" column was filled using the
|
||||
`clock_resolution.py
|
||||
The "OS Resolution" is the resolution announced by the operating
|
||||
system.
|
||||
The "Python Resolution" is the smallest difference between two calls
|
||||
to the time function computed in Python using the `clock_resolution.py
|
||||
<http://hg.python.org/peps/file/tip/pep-0418/clock_resolution.py>`_
|
||||
program.
|
||||
|
||||
|
@ -1242,45 +1252,50 @@ Process Time
|
|||
The process time cannot be set. It is not monotonic: the clocks stop
|
||||
while the process is idle.
|
||||
|
||||
========================= ========== ============================ ===============
|
||||
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() \- Yes on Windows, No otherwise No
|
||||
========================= ========== ============================ ===============
|
||||
========================= ============ ============================ ===============
|
||||
Name C 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() \- Yes on Windows, No otherwise No
|
||||
========================= ============ ============================ ===============
|
||||
|
||||
The "C Resolution" column is the resolution of the underlying C
|
||||
structure.
|
||||
|
||||
Examples of clock precision on x86_64:
|
||||
|
||||
========================= ================ ========= ===================
|
||||
Name Operating system Precision Python Resolution
|
||||
========================= ================ ========= ===================
|
||||
CLOCK_PROCESS_CPUTIME_ID Linux 3.3 1 ns 1 ns
|
||||
CLOCK_PROF FreeBSD 8.2 10 ms 1 µs
|
||||
getrusage(RUSAGE_SELF) FreeBSD 8.2 \- 1 µs
|
||||
getrusage(RUSAGE_SELF) SunOS 5.11 \- 1 µs
|
||||
CLOCK_PROCESS_CPUTIME_ID Linux 3.0 1 ns 1 µs
|
||||
getrusage(RUSAGE_SELF) Mac OS 10.6 \- 5 µs
|
||||
clock() Mac OS 10.6 1 µs 5 µs
|
||||
CLOCK_PROF OpenBSD 5.0 \- 5 µs
|
||||
getrusage(RUSAGE_SELF) Linux 3.0 \- 4 ms
|
||||
getrusage(RUSAGE_SELF) OpenBSD 5.0 \- 8 ms
|
||||
clock() FreeBSD 8.2 8 ms 8 ms
|
||||
clock() Linux 3.0 1 µs 10 ms
|
||||
times() Linux 3.0 10 ms 10 ms
|
||||
clock() OpenBSD 5.0 10 ms 10 ms
|
||||
times() OpenBSD 5.0 10 ms 10 ms
|
||||
times() Mac OS 10.6 10 ms 10 ms
|
||||
clock() SunOS 5.11 1 µs 10 ms
|
||||
times() SunOS 5.11 1 µs 10 ms
|
||||
GetProcessTimes() Windows Seven 16 ms 16 ms
|
||||
clock() Windows Seven 1 ms 1 ms
|
||||
========================= ================ ========= ===================
|
||||
========================= ================ ============= ===================
|
||||
Name Operating system OS Resolution Python Resolution
|
||||
========================= ================ ============= ===================
|
||||
CLOCK_PROCESS_CPUTIME_ID Linux 3.3 1 ns 1 ns
|
||||
CLOCK_PROF FreeBSD 8.2 10 ms 1 µs
|
||||
getrusage(RUSAGE_SELF) FreeBSD 8.2 \- 1 µs
|
||||
getrusage(RUSAGE_SELF) SunOS 5.11 \- 1 µs
|
||||
CLOCK_PROCESS_CPUTIME_ID Linux 3.0 1 ns 1 µs
|
||||
getrusage(RUSAGE_SELF) Mac OS 10.6 \- 5 µs
|
||||
clock() Mac OS 10.6 1 µs 5 µs
|
||||
CLOCK_PROF OpenBSD 5.0 \- 5 µs
|
||||
getrusage(RUSAGE_SELF) Linux 3.0 \- 4 ms
|
||||
getrusage(RUSAGE_SELF) OpenBSD 5.0 \- 8 ms
|
||||
clock() FreeBSD 8.2 8 ms 8 ms
|
||||
clock() Linux 3.0 1 µs 10 ms
|
||||
times() Linux 3.0 10 ms 10 ms
|
||||
clock() OpenBSD 5.0 10 ms 10 ms
|
||||
times() OpenBSD 5.0 10 ms 10 ms
|
||||
times() Mac OS 10.6 10 ms 10 ms
|
||||
clock() SunOS 5.11 1 µs 10 ms
|
||||
times() SunOS 5.11 1 µs 10 ms
|
||||
GetProcessTimes() Windows Seven 16 ms 16 ms
|
||||
clock() Windows Seven 1 ms 1 ms
|
||||
========================= ================ ============= ===================
|
||||
|
||||
The "Python Resolution" column was filled using the
|
||||
`clock_resolution.py
|
||||
The "OS Resolution" is the resolution announced by the operating
|
||||
system.
|
||||
The "Python Resolution" is the smallest difference between two calls
|
||||
to the time function computed in Python using the `clock_resolution.py
|
||||
<http://hg.python.org/peps/file/tip/pep-0418/clock_resolution.py>`_
|
||||
program.
|
||||
|
||||
|
@ -1321,25 +1336,30 @@ Thread Time
|
|||
The thread time cannot be set. It is not monotonic: the clocks stop
|
||||
while the thread is idle.
|
||||
|
||||
========================= ========== ============= ===============
|
||||
Name Resolution Include sleep Include suspend
|
||||
========================= ========== ============= ===============
|
||||
CLOCK_THREAD_CPUTIME_ID 1 ns Yes Epoch changes
|
||||
GetThreadTimes() 100 ns No ?
|
||||
========================= ========== ============= ===============
|
||||
========================= ============ ============= ===============
|
||||
Name C Resolution Include Sleep Include Suspend
|
||||
========================= ============ ============= ===============
|
||||
CLOCK_THREAD_CPUTIME_ID 1 ns Yes Epoch changes
|
||||
GetThreadTimes() 100 ns No ?
|
||||
========================= ============ ============= ===============
|
||||
|
||||
The "C Resolution" column is the resolution of the underlying C
|
||||
structure.
|
||||
|
||||
Examples of clock precision on x86_64:
|
||||
|
||||
========================= ================ =============== =================
|
||||
Name Operating system Precision Python Resolution
|
||||
========================= ================ =============== =================
|
||||
CLOCK_THREAD_CPUTIME_ID FreeBSD 8.2 1 µs 1 µs
|
||||
CLOCK_THREAD_CPUTIME_ID Linux 3.3 1 ns 649 ns
|
||||
GetThreadTimes() Windows Seven 16 ms 16 ms
|
||||
========================= ================ =============== =================
|
||||
========================= ================ ============= =================
|
||||
Name Operating system OS Resolution Python Resolution
|
||||
========================= ================ ============= =================
|
||||
CLOCK_THREAD_CPUTIME_ID FreeBSD 8.2 1 µs 1 µs
|
||||
CLOCK_THREAD_CPUTIME_ID Linux 3.3 1 ns 649 ns
|
||||
GetThreadTimes() Windows Seven 16 ms 16 ms
|
||||
========================= ================ ============= =================
|
||||
|
||||
The "Python Resolution" column was filled using the
|
||||
`clock_resolution.py
|
||||
The "OS Resolution" is the resolution announced by the operating
|
||||
system.
|
||||
The "Python Resolution" is the smallest difference between two calls
|
||||
to the time function computed in Python using the `clock_resolution.py
|
||||
<http://hg.python.org/peps/file/tip/pep-0418/clock_resolution.py>`_
|
||||
program.
|
||||
|
||||
|
@ -1388,29 +1408,32 @@ sleep duration is 90 seconds in the real time.
|
|||
|
||||
Sleep can be interrupted by a signal: the function fails with EINTR.
|
||||
|
||||
======================== ==========
|
||||
Name Resolution
|
||||
======================== ==========
|
||||
nanosleep() 1 ns
|
||||
clock_nanosleep() 1 ns
|
||||
usleep() 1 µs
|
||||
delay() 1 µs
|
||||
sleep() 1 sec
|
||||
======================== ==========
|
||||
======================== ============
|
||||
Name C Resolution
|
||||
======================== ============
|
||||
nanosleep() 1 ns
|
||||
clock_nanosleep() 1 ns
|
||||
usleep() 1 µs
|
||||
delay() 1 µs
|
||||
sleep() 1 sec
|
||||
======================== ============
|
||||
|
||||
Other functions:
|
||||
|
||||
======================== ==========
|
||||
Name Resolution
|
||||
======================== ==========
|
||||
sigtimedwait() 1 ns
|
||||
pthread_cond_timedwait() 1 ns
|
||||
sem_timedwait() 1 ns
|
||||
select() 1 µs
|
||||
epoll() 1 ms
|
||||
poll() 1 ms
|
||||
WaitForSingleObject() 1 ms
|
||||
======================== ==========
|
||||
======================== ============
|
||||
Name C Resolution
|
||||
======================== ============
|
||||
sigtimedwait() 1 ns
|
||||
pthread_cond_timedwait() 1 ns
|
||||
sem_timedwait() 1 ns
|
||||
select() 1 µs
|
||||
epoll() 1 ms
|
||||
poll() 1 ms
|
||||
WaitForSingleObject() 1 ms
|
||||
======================== ============
|
||||
|
||||
The "C Resolution" column is the resolution of the underlying C
|
||||
structure.
|
||||
|
||||
|
||||
Functions
|
||||
|
|
Loading…
Reference in New Issue