How to measure elapsed time under Windows?
ptmcg at austin.rr.com
Wed Feb 10 14:37:22 CET 2010
On Feb 10, 2:24 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Tue, 9 Feb 2010 21:45:38 +0000 (UTC), Grant Edwards
> <inva... at invalid.invalid> declaimed the following in
> > Doesn't work. datetime.datetime.now has granularity of
> > 15-16ms.
> > Intervals much less that that often come back with a delta of
> > 0. A delay of 20ms produces a delta of either 15-16ms or
> > 31-32ms
> WinXP uses an ~15ms time quantum for task switching. Which defines
> the step rate of the wall clock output...
> Wulfraed Dennis Lee Bieber KD6MOG
> wlfr... at ix.netcom.com HTTP://wlfraed.home.netcom.com/
Gabriel Genellina reports that time.clock() uses Windows'
QueryPerformanceCounter() API, which has much higher resolution than
the task switcher's 15ms. QueryPerformanceCounter's resolution is
hardware-dependent; using the Win API, and a little test program, I
get this value on my machine:
Frequency is 3579545 ticks/sec
Resolution is 0.279365114840015 microsecond/tick
More information about the Python-list