Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-10 Thread Victor Stinner
We're going around in circles. I'm not asking what sleep does, I want on principle a timer that does the same thing as sleep(), regardless of how sleep() works. So if on some OS sleep() uses the same algorithm as CLOCK_MONOTONIC_RAW, I want my timer to use that too. But if on some other OS

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-09 Thread Victor Stinner
2012/4/9 Guido van Rossum gu...@python.org: You may need two clocks for this:  * time.perf_counter(): high-resolution timer for benchmarking, count time elasped during a sleep  * time.process_time(): High-resolution (?) per-process timer from the CPU. (other possible names:

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-09 Thread Victor Stinner
|  * time.process_time(): High-resolution (?) per-process timer from the | CPU. (other possible names: time.process_cpu_time() or | time.cpu_time()) POSIX offers CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID that seem to suit this need, depending on your threading situation (and what

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-09 Thread Cameron Simpson
On 09Apr2012 13:26, Victor Stinner victor.stin...@gmail.com wrote: | | On Windows, GetProcessTimes() has not a high-resolution: it has a | | accuracy of 1 ms in the best case. | | This page: |   http://msdn.microsoft.com/en-us/library/windows/desktop/ms683223%28v=vs.85%29.aspx | says

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-09 Thread Victor Stinner
sleep() is implemented in the kernel. The kernel is notified when a clock is set, and so can choose how to handle time adjustement. Most sleeping functions use the system clock but don't care of clock adjustement. We're going around in circles. I'm not asking what sleep does, I want on

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-08 Thread Antoine Pitrou
| I made the same suggestion earlier but I don't know that anyone did | anything with it. :-( It would be nice to know what clock sleep() uses | on each of the major platforms. I saw it but didn't know what I could do with it, or even if it can be found out in any very general sense.

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-08 Thread Guido van Rossum
On Sun, Apr 8, 2012 at 3:42 AM, Antoine Pitrou solip...@pitrou.net wrote: | I made the same suggestion earlier but I don't know that anyone did | anything with it. :-( It would be nice to know what clock sleep() uses | on each of the major platforms. I saw it but didn't know what I could do

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-08 Thread Antoine Pitrou
On Sun, 8 Apr 2012 07:29:30 -0700 Guido van Rossum gu...@python.org wrote: What to name it can't be decided this way, although I might put forward time.sleeptimer(). interval_timer() ? I would suggest timer() simply, but it's too close to time(). I personally have a need for one potentially

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-08 Thread Victor Stinner
IOW What's good enough for sleep() is good enough for user-implemented timeouts and scheduling. as a way to reach at least one decision for a platform with agreed-upon cross-platform characteristics that are useful. sleep() is implemented in the kernel. The kernel is notified when a clock is

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-08 Thread Cameron Simpson
On 09Apr2012 02:00, Victor Stinner victor.stin...@gmail.com wrote: | I personally have a need for one potentially different clock -- to | measure short intervals for benchmarks and profiling. This might be | called time.performancetimer()? | | I deferred this topic because it is unclear to me

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-08 Thread Guido van Rossum
On Sun, Apr 8, 2012 at 5:00 PM, Victor Stinner victor.stin...@gmail.com wrote: IOW What's good enough for sleep() is good enough for user-implemented timeouts and scheduling. as a way to reach at least one decision for a platform with agreed-upon cross-platform characteristics that are useful.

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-07 Thread Stephen J. Turnbull
On Fri, Apr 6, 2012 at 11:32 PM, Victor Stinner victor.stin...@gmail.com wrote: On Linux, I now prefer to use CLOCK_MONOTONIC (monotonic) than CLOCK_MONOTONIC_RAW (monotonic and steady as defined by C++) *because* its frequency is adjusted. I don't think that's a reason that should be

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-07 Thread Stephen J. Turnbull
On Sat, Apr 7, 2012 at 8:47 AM, Victor Stinner victor.stin...@gmail.com wrote: Objects of class steady_clock represent clocks for which values of time_point advance at a steady rate relative to real time. That is, the clock may not be adjusted.

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-07 Thread Paul Moore
On 7 April 2012 09:12, Stephen J. Turnbull step...@xemacs.org wrote: I don't think that's a reason that should be considered.  There just doesn't seem to be a single best clock, nor do clocks of similar character seem to be easy to find across platforms.  So the reasons I'd like to see are of

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-07 Thread Cameron Simpson
On 07Apr2012 01:47, Victor Stinner victor.stin...@gmail.com wrote: | I don't understand this definition. All clocks have a clock drift. | This is just one exception: atomic clocks, but such clocks are rare | and very expensive. They've got drift too. It is generally very small. Anecdote: I used

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-07 Thread Raymond Hettinger
On Apr 7, 2012, at 3:08 AM, Paul Moore wrote: Use cases: Display the current time to a human (e.g. display a calendar or draw a wall clock): use system clock, i.e. time.time() or datetime.datetime.now(). Event scheduler, timeout: time.monotonic(). Benchmark, profiling: time.clock() on

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-07 Thread Kristján Valur Jónsson
Thank you for your veto. Still, again for the sake of keeping track of things and such, there is this: http://en.wikipedia.org/wiki/Wall_clock_time and also my original suggestion: http://bugs.python.org/issue10278 In the end, the world shall be ruled by the nomenclaturists. K

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-07 Thread Raymond Hettinger
Just to clarify my previous post. It seems clear that benchmarking and timeout logic would benefit from a clock that cannot be adjusted by NTP. I'm unclear on whether time.sleep() will be based on the same clock so that timeouts and sleeps are on the same basis. For scheduling logic (such as

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-07 Thread Cameron Simpson
Victor et al, Just an update note: I've started marking up clocks with attributes; not yet complete and I still need to make a small C extension to present the system clocks to Python space (which means learning to do that, too). But you can glance over the start on it here:

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-07 Thread Guido van Rossum
On Sat, Apr 7, 2012 at 6:26 PM, Raymond Hettinger raymond.hettin...@gmail.com wrote: Just to clarify my previous post. It seems clear that benchmarking and timeout logic would benefit from a clock that cannot be adjusted by NTP. I'm unclear on whether time.sleep() will be based on the same

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-07 Thread Cameron Simpson
On 07Apr2012 18:49, Guido van Rossum gu...@python.org wrote: | On Sat, Apr 7, 2012 at 6:26 PM, Raymond Hettinger | raymond.hettin...@gmail.com wrote: | Just to clarify my previous post. | It seems clear that benchmarking and timeout logic would benefit | from a clock that cannot be adjusted by

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Glyph Lefkowitz
On Apr 5, 2012, at 8:07 PM, Zooko Wilcox-O'Hearn wrote: On Thu, Apr 5, 2012 at 7:14 PM, Greg Ewing greg.ew...@canterbury.ac.nz wrote: This is the strict mathematical meaning of the word monotonic, but the way it's used in relation to OS clocks, it seems to mean rather more than that.

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Stephen J. Turnbull
On Fri, Apr 6, 2012 at 3:39 PM, Glyph Lefkowitz gl...@twistedmatrix.com wrote: There seems to be a persistent desire in this discussion to specify and define these flaws out of existence, where this API really should instead be embracing the flaws and classifying them. That seems to be

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Steven D'Aprano
Glyph Lefkowitz wrote: On Apr 5, 2012, at 8:07 PM, Zooko Wilcox-O'Hearn wrote: 2. Those who think that monotonic clock means a clock that never jumps, and that runs at a rate approximating the rate of real time. This is a very useful kind of clock to have! It is what C++ now calls a steady

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Paul Moore
On 6 April 2012 11:12, Steven D'Aprano st...@pearwood.info wrote: Glyph Lefkowitz wrote: On Apr 5, 2012, at 8:07 PM, Zooko Wilcox-O'Hearn wrote: 2. Those who think that monotonic clock means a clock that never jumps, and that runs at a rate approximating the rate of real time. This is a

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Victor Stinner
2. Those who think that monotonic clock means a clock that never jumps, and that runs at a rate approximating the rate of real time. This is a very useful kind of clock to have! It is what C++ now calls a steady clock. It is what all the major operating systems provide. Python cannot give

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Guido van Rossum
I'd like to veto wall clock because to me that's the clock on my wall, i.e. local time. Otherwise I like the way this thread is going. --Guido van Rossum (sent from Android phone) On Apr 6, 2012 4:57 AM, Paul Moore p.f.mo...@gmail.com wrote: On 6 April 2012 11:12, Steven D'Aprano

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Kristján Valur Jónsson
This is the most amusing of discussions. Teh key sentence here is the clock may not be adjusted. Slewing or accelerating a clock is nerely adding to the already present error of the pace of the clock. Sometimes a clock runs fast, sometimes it runs slow. This is without any purposeful slewing

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Kristján Valur Jónsson
This is the original reason for the original defect (issue 10278) unix' clock() doesn't actually provide a clock in this sense, it provides a resource usage metric. K Frá: python-dev-bounces+kristjan=ccpgames@python.org

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Cameron Simpson
On 06Apr2012 15:19, I wrote: | On 06Apr2012 14:31, Steven D'Aprano st...@pearwood.info wrote: | | Here is a non-monotonic sequence: | | | | 1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 8 | | | | This isn't steady either, because it jumps backwards. | | | | To be steady, it MUST also be monotonic. If

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Cameron Simpson
On 06Apr2012 17:07, Kristj�n Valur J�nsson krist...@ccpgames.com wrote: | Steven D'Aprano: | I think that this is incorrect. | py time.clock(); time.sleep(10); time.clock() | 0.41 | 0.41 | | This is the original reason for the original defect (issue 10278) | unix' clock() doesn't actually

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Victor Stinner
| This is the original reason for the original defect (issue 10278) | unix' clock() doesn't actually provide a clock in this sense, it provides a resource usage metric. Yeah:-( Its help says Return the CPU time or real time since [...]. Two very different things, as demonstrated. I suppose

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-06 Thread Victor Stinner
2. Those who think that monotonic clock means a clock that never jumps, and that runs at a rate approximating the rate of real time. This is a very useful kind of clock to have! It is what C++ now calls a steady clock. It is what all the major operating systems provide. For the C++ part, I

[Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-05 Thread Zooko Wilcox-O'Hearn
On Thu, Apr 5, 2012 at 7:14 PM, Greg Ewing greg.ew...@canterbury.ac.nz wrote: This is the strict mathematical meaning of the word monotonic, but the way it's used in relation to OS clocks, it seems to mean rather more than that. Yep. As far as I can tell, nobody has a use for an unsteady,

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-05 Thread Cameron Simpson
On 05Apr2012 21:07, Zooko Wilcox-O'Hearn zo...@zooko.com wrote: | On Thu, Apr 5, 2012 at 7:14 PM, Greg Ewing greg.ew...@canterbury.ac.nz wrote: | This is the strict mathematical meaning of the word monotonic, | but the way it's used in relation to OS clocks, it seems to mean rather | more than

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-05 Thread Steven D'Aprano
Cameron Simpson wrote: | The main reason to use the word monotonic clock to refer to the | second concept is that POSIX does so, but since Mac OS X, Solaris, | Windows, and C++ have all avoided following POSIX's mistake, I think | Python should too. No. If it is not monotonic, DO NOT CALL IT

Re: [Python-Dev] this is why we shouldn't call it a monotonic clock (was: PEP 418 is too divisive and confusing and should be postponed)

2012-04-05 Thread Cameron Simpson
On 06Apr2012 14:31, Steven D'Aprano st...@pearwood.info wrote: | Cameron Simpson wrote: | | The main reason to use the word monotonic clock to refer to the | | second concept is that POSIX does so, but since Mac OS X, Solaris, | | Windows, and C++ have all avoided following POSIX's mistake, I