[Python-checkins] [Fwd: Re: r46146 - sandbox/trunk/rjsh-pybench/pybench.py]

Steve Holden steve at holdenweb.com
Fri May 26 13:48:10 CEST 2006


Mats:

Someone raised the question of whether QueryPerformanceCounter is 
available on various 64-bit platforms, and I promised I'd contact you to 
find out about Itanium. Any informnation you can offer on the whole 
topic of timing under 64-bit Windows would be helpful.

regards
  Steve

-------- Original Message --------
Subject: Re: [Python-checkins] r46146 - 
sandbox/trunk/rjsh-pybench/pybench.py
Date: Thu, 25 May 2006 08:42:19 +0000
From: Tim Peters <tim.peters at gmail.com>
To: python-checkins at python.org
[Tim]
...
>> time.clock() has sub-microsecond resolution (better than a millionth
>> of a second) on all flavors of Windows.

[Martin v. Löwis]
> Are you sure about that? It has a *scale* of sub-microseconds (100ns);
> the resolution is unspecified.

"Most" Windows boxes run on HW with a capable real-time counter.

> clock() uses GetSystemTimeAsFileTime(). This likely reads some
> kernel variable, and I very much doubt that this kernel variable
> is updated every 100ns. For example, in ...

Windoes clock() does, yes, but Python's time.clock() on Windows does
not.  See the source ;-)

> ...
> To get a finer time measurement, you should use QueryPerformanceCounter.
> On x86 processors that support it, this uses rdtsc to fetch the
> time-stamping counter:

That's exactly what Python uses for time.clock() on Windows ...
although I see it doesn't on Win64:

#if defined(MS_WINDOWS) && !defined(MS_WIN64) && !defined(__BORLANDC__)
/* Win32 has better clock replacement
    XXX Win64 does not yet, but might when the platform matures. */
#undef HAVE_CLOCK /* We have our own version down below */
#endif /* MS_WINDOWS && !MS_WIN64 */

Do you know whether Win64 still has that limitation?
_______________________________________________
Python-checkins mailing list
Python-checkins at python.org
http://mail.python.org/mailman/listinfo/python-checkins




-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Love me, love my blog  http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden


More information about the Python-checkins mailing list