This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients MrJean1, alexandre.vassalotti, gregory.p.smith, nirai, pitrou
Date 2010-05-18.12:44:25
SpamBayes Score 0.0935189
Marked as misclassified No
Message-id <1274186667.71.0.0933152645094.issue2281@psf.upfronthosting.co.za>
In-reply-to
Content
Regarding the calibrating loop when using ASM timestamp counters, there's one problem if the thread gets preempted in the middle of the loop: the calibration will return incorrect results. Perhaps a way of avoiding this would be to call nanosleep(1 ns) just before the loop, which should relinquish the current timeslice.

Another issue can appear when threads migrate from one CPU core to another, according to Wikipedia: “AMD processors up to the K8 core always incremented the time-stamp counter every clock cycle.[5] Thus, power management features were able to change the number of increments per second, and the values could get out of sync between different cores or processors in the same system.”

Perhaps using clock_gettime(CLOCK_REALTIME or CLOCK_MONOTONIC) is better than using raw ASM timestamp counters, when available.
History
Date User Action Args
2010-05-18 12:44:27pitrousetrecipients: + pitrou, gregory.p.smith, alexandre.vassalotti, MrJean1, nirai
2010-05-18 12:44:27pitrousetmessageid: <1274186667.71.0.0933152645094.issue2281@psf.upfronthosting.co.za>
2010-05-18 12:44:25pitroulinkissue2281 messages
2010-05-18 12:44:25pitroucreate