[Python-checkins] peps: PEP 418: QueryPerformanceCounter() has a known bug

victor.stinner python-checkins at python.org
Thu Mar 29 01:11:36 CEST 2012


http://hg.python.org/peps/rev/2dc9466b8917
changeset: 4164:2dc9466b8917
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Mar 29 01:11:16 2012 +0200
summary:
 PEP 418: QueryPerformanceCounter() has a known bug
files:
 pep-0418.txt | 21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/pep-0418.txt b/pep-0418.txt
--- a/pep-0418.txt
+++ b/pep-0418.txt
@@ -240,15 +240,21 @@
 QueryPerformanceFrequency() gives its frequency.
 
 On Windows XP, QueryPerformanceFrequency() is the processor frequency and
-QueryPerformanceCounter() is the TSC of the current processor. Windows XP
-had a bug (see `KB896256 <http://support.microsoft.com/?id=896256>`_): on a
-multiprocessor computer, QueryPerformanceCounter() returned a different value
-for each processor.
+QueryPerformanceCounter() is the TSC of the current processor.
+
+The performance counter value may unexpectedly leap forward because of a
+hardware bug, see the `KB274323`_.
+
+Windows XP had a bug (see `KB896256`_): on a multiprocessor computer,
+QueryPerformanceCounter() returned a different value for each processor.
 
 QueryPerformanceFrequency() should only be called once: the frequency will not
 change while the system is running. It fails if the installed hardware does not
 support a high-resolution performance counter.
 
+.. _KB896256: http://support.microsoft.com/?id=896256
+.. _KB274323: http://support.microsoft.com/?id=274323
+
 
 Windows: GetTickCount(), GetTickCount64()
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -428,7 +434,12 @@
 values returned are indeed monotonic.
 
 * Virtual machines provide less reliable clocks.
- * QueryPerformanceCounter() had a bug in 2006 on multiprocessor computers
+ * QueryPerformanceCounter() has two known bugs:
+ `KB896256`_ (fixed) and `KB274323`_
+
+Python may only workaround a specific known operating system bug: `KB274323`_
+contains a code example to workaround the bug (use GetTickCount() to detect
+QueryPerformanceCounter() leap).
 
 
 Footnotes
-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /