Tim Roberts wrote: > "Tim Peters" <[EMAIL PROTECTED]> wrote: > > >>[Giovanni Bajo[ >> >>>>I experimented something very strange, a few days ago. I was debugging an >>>>application at a customer's site, and the problem turned out to be that >>>>time.clock() was going "backwards", that is it was sometimes >>>>(randomically) returning a floating point value which was "less than" the >>>>value returned by the previous invokation. The computer was a pretty fast >>>>one (P4 3Ghz I think, running Windows XP), and this happened only between >>>>very close invokations of time.clock(). >> >>[Terry Reed] >> >>>I seem to remember this being mentioned before on the list, perhaps by Tim >>>Peters. Perhaps he will chime in. >> >>No real need ;-) BIOS or HAL bug on a multiprocessor (or maybe even >>hyperthreaded) box is by far the most likely cause (and the only cause >>ever identified for sure by people who followed up). Python's C code >>slinging QueryPerformanceCounter is exceedingly simple, and isn't a >>suspect because of that. It's on the edge of vague possibility that >>Microsoft's compiler generates non-monotonic code for converting >>64-bit integer to double: > > > It is much simpler than that. With a multiprocessor HAL, including on a > dual-core or hyperthreaded system, QueryPerformanceCounter returns the raw > cycle counter (RDTSC). However, on Windows XP, the operating system does > not synchronize the cycle counters on multiple processors, and they can be > actually be millions of cycles apart. > > This was a change from previous systems. On NT4 and Win2000, the operating > actually rewrote the cycle counters on the second (and beyond) processors > to align them to the first processor, so the delta was usually only a dozen > or two cycles. XP does not appear to do that. I think that is a huge > mistake, since it renders QueryPerformanceCounter non-monotonic.
How does it come, that processors on same mainboard run at different speeds? Do they have separate clock-pulse generators? I can remember, that (at least on very old motherboards) the clock-pulse generator was a separate element and the processor just used it, so I would expect, that even in case of multiple processors, if there were only one clock-pulse generator for all of them, they were not be able to run at different speeds. Claudio Grondi -- http://mail.python.org/mailman/listinfo/python-list