[Python-checkins] r46146 - sandbox/trunk/rjsh-pybench/pybench.py
Tim Peters
tim.peters at gmail.com
Thu May 25 10:42:19 CEST 2006
[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?
More information about the Python-checkins
mailing list