PEP 418: Add benchmark results of Mac OS 10.6

Fix also clock_precision.py: catch clock_gettime() errors
This commit is contained in:
Victor Stinner 2012-04-17 23:59:33 +02:00
parent e80b7c5d8b
commit 38da45e1bb
2 changed files with 14 additions and 3 deletions

View File

@ -902,11 +902,12 @@ Examples of clock precision on x86_64:
========================= ================ ========= =================== ========================= ================ ========= ===================
Name Operating system Precision Precision in Python Name Operating system Precision Precision in Python
========================= ================ ========= =================== ========================= ================ ========= ===================
CLOCK_HIGHRES SunOS 5.11 2 ns 2 µs CLOCK_HIGHRES SunOS 5.11 2 ns 253 ns
CLOCK_MONOTONIC Linux 3.2 1 ns 2 µs CLOCK_MONOTONIC Linux 3.2 1 ns 2 µs
CLOCK_MONOTONIC SunOS 5.11 2 ns 3 µs CLOCK_MONOTONIC SunOS 5.11 2 ns 3 µs
CLOCK_MONOTONIC_RAW Linux 3.2 1 ns 3 µs CLOCK_MONOTONIC_RAW Linux 3.2 1 ns 3 µs
CLOCK_BOOTTIME Linux 3.3 1 ns 3 µs CLOCK_BOOTTIME Linux 3.3 1 ns 3 µs
mach_absolute_time() Mac OS 10.6 1 ns 3 µs
CLOCK_MONOTONIC FreeBSD 8.2 11 ns 7 µs CLOCK_MONOTONIC FreeBSD 8.2 11 ns 7 µs
CLOCK_MONOTONIC OpenBSD 5.0 10 ms 7 µs CLOCK_MONOTONIC OpenBSD 5.0 10 ms 7 µs
QueryPerformanceCounter Windows Seven 10 ns 9 µs QueryPerformanceCounter Windows Seven 10 ns 9 µs
@ -1151,8 +1152,9 @@ Examples of clock precision on x86_64:
========================= ================ ========= =================== ========================= ================ ========= ===================
Name Operating system Precision Precision in Python Name Operating system Precision Precision in Python
========================= ================ ========= =================== ========================= ================ ========= ===================
CLOCK_REALTIME SunOS 5.11 10 ms 2 µs CLOCK_REALTIME SunOS 5.11 10 ms 238 ns
CLOCK_REALTIME Linux 3.2 1 ns 2 µs CLOCK_REALTIME Linux 3.2 1 ns 2 µs
gettimeofday() Mac OS 10.6 1 µs 4 µs
CLOCK_REALTIME FreeBSD 8.2 11 ns 7 µs CLOCK_REALTIME FreeBSD 8.2 11 ns 7 µs
CLOCK_REALTIME OpenBSD 5.0 10 ms 10 µs CLOCK_REALTIME OpenBSD 5.0 10 ms 10 µs
CLOCK_REALTIME_COARSE Linux 3.3 1 ms 1 ms CLOCK_REALTIME_COARSE Linux 3.3 1 ms 1 ms
@ -1212,9 +1214,12 @@ Examples of clock precision on x86_64:
========================= ================ ========= =================== ========================= ================ ========= ===================
Name Operating system Precision Precision in Python Name Operating system Precision Precision in Python
========================= ================ ========= =================== ========================= ================ ========= ===================
CLOCK_PROF FreeBSD 8.2 10 ms 1 µs
getrusage(RUSAGE_SELF) FreeBSD 8.2 \- 1 µs getrusage(RUSAGE_SELF) FreeBSD 8.2 \- 1 µs
CLOCK_PROCESS_CPUTIME_ID Linux 3.2 1 ns 3 µs CLOCK_PROCESS_CPUTIME_ID Linux 3.2 1 ns 3 µs
getrusage(RUSAGE_SELF) SunOS 5.11 \- 3 µs getrusage(RUSAGE_SELF) SunOS 5.11 \- 1 µs
getrusage(RUSAGE_SELF) Mac OS 10.6 \- 5 µs
clock() Mac OS 10.6 1 µs 5 µs
getrusage(RUSAGE_SELF) Linux 3.3 \- 1 ms getrusage(RUSAGE_SELF) Linux 3.3 \- 1 ms
getrusage(RUSAGE_SELF) OpenBSD 5.0 \- 8 ms getrusage(RUSAGE_SELF) OpenBSD 5.0 \- 8 ms
clock() FreeBSD 8.2 8 ms 8 ms clock() FreeBSD 8.2 8 ms 8 ms
@ -1222,6 +1227,7 @@ clock() Linux 3.2 1 µs 10 ms
times() Linux 3.0 10 ms 10 ms times() Linux 3.0 10 ms 10 ms
clock() OpenBSD 5.0 10 ms 10 ms clock() OpenBSD 5.0 10 ms 10 ms
times() OpenBSD 5.0 10 ms 10 ms times() OpenBSD 5.0 10 ms 10 ms
times() Mac OS 10.6 10 ms 10 ms
GetProcessTimes() Windows Seven 16 ms 16 ms GetProcessTimes() Windows Seven 16 ms 16 ms
clock() SunOS 5.11 1 µs 10 ms clock() SunOS 5.11 1 µs 10 ms
========================= ================ ========= =================== ========================= ================ ========= ===================

View File

@ -51,6 +51,11 @@ for clock_id_text in clock_ids:
name = 'clock_gettime(%s)' % clock_id_text name = 'clock_gettime(%s)' % clock_id_text
def gettime(): def gettime():
return time.clock_gettime(clock_id) return time.clock_gettime(clock_id)
try:
gettime()
except OSError as err:
print("%s failed: %s" % (name, err))
continue
test_clock(name, gettime) test_clock(name, gettime)
precision = time.clock_getres(clock_id) precision = time.clock_getres(clock_id)
print("- announced precision: %s" % format_duration(precision)) print("- announced precision: %s" % format_duration(precision))