How to measure elapsed time under Windows?
invalid at invalid.invalid
Wed Feb 10 17:15:22 CET 2010
On 2010-02-09, Gabriel Genellina <gagsl-py2 at yahoo.com.ar> wrote:
> En Tue, 09 Feb 2010 13:10:56 -0300, Grant Edwards
><invalid at invalid.invalid> escribi?:
>> What's the correct way to measure small periods of elapsed
>> time. I've always used time.clock() in the past:
>> However on multi-processor machines that doesn't work.
>> Sometimes I get negative values for delta. According to
>> google, this is due to a bug in Windows that causes the value
>> of time.clock() to be different depending on which core in a
>> multi-core CPU you happen to be on. [insert appropriate
>> MS-bashing here]
> I'm not sure you can blame MS of this issue; anyway, this
> patch should fix the problem:
I'm curious why it wouldn't be Microsoft's fault, because
A) Everything is Microsoft's fault. ;)
B) If a patch to MS Windows fixes the problem, how is it not a
problem in MS Windows?
>> Is there a way to lock the python process to a single core so
>> that time.clock() works right?
> Interactively, from the Task Manager:
Thanks. That looks a bit easier than disabling the second core
(which is what I ended up doing).
> In code, using SetProcessAffinityMask and related functions:
With help from google and some old mailing list posting I might
even try that.
Grant Edwards grante Yow! It's a lot of fun
at being alive ... I wonder if
visi.com my bed is made?!?
More information about the Python-list