[issue13481] Use an accurate clock in timeit

2011-11-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, closing. -- resolution: -> rejected stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___ __

[issue13481] Use an accurate clock in timeit

2011-11-29 Thread Charles-François Natali
Charles-François Natali added the comment: > Are CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC and CLOCK_REALTIME more accurate > than gettimeofday (time.time)? Actually, on Linux gettimeofday() returns CLOCK_REALTIME. As for CLOCK_MONOTONIC{_RAW}, they're guaranteed not to go backward (NTP and such).

[issue13481] Use an accurate clock in timeit

2011-11-28 Thread STINNER Victor
STINNER Victor added the comment: Are CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC and CLOCK_REALTIME more accurate than gettimeofday (time.time)? -- nosy: +haypo ___ Python tracker __

[issue13481] Use an accurate clock in timeit

2011-11-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: I think this should be rejected. -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-lis

[issue13481] Use an accurate clock in timeit

2011-11-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: > > But does it include kernel CPU time for the given process? > > Yes. But it won't be reliable, for example, to measure the performance > of a new readinto() implentation, since time spent by the process in > 'S' or 'D' state won't be accounted for. Then I'm

[issue13481] Use an accurate clock in timeit

2011-11-26 Thread Charles-François Natali
Charles-François Natali added the comment: > Indeed. I thought CPU time would be more useful (and that's the point > of the patch) Ah, OK. Then you should probably rename the issue "make timeit measure CPU time", or something like that, because I really thought this issue was about using a mor

[issue13481] Use an accurate clock in timeit

2011-11-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: > With CLOCK_PROCESS_CPUTIME_ID: > - depending on the platform, we'll measure either wall-clock time or > CPU time Indeed. I thought CPU time would be more useful (and that's the point of the patch) but perhaps it breaks the spec. > - preemtion, blocking sysca

[issue13481] Use an accurate clock in timeit

2011-11-26 Thread Charles-François Natali
Charles-François Natali added the comment: _clocks = ['CLOCK_PROCESS_CPUTIME_ID', 'CLOCK_MONOTONIC_RAW', 'CLOCK_MONOTONIC', 'CLOCK_REALTIME'] Beware, we're mixing CPU time and wall-clock time: $ ./python -c "from time import *; id = CLOCK_REALTIME; t = clock_gettime(id); sleep(

[issue13481] Use an accurate clock in timeit

2011-11-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: Well, you only call the clock at the begining and end of a timing run, not at each iteration. -- ___ Python tracker ___ __

[issue13481] Use an accurate clock in timeit

2011-11-25 Thread Georg Brandl
Georg Brandl added the comment: So does the accuracy outweigh using a Python function to call the actual clock function? (and usuable -> usable) -- ___ Python tracker ___ _

[issue13481] Use an accurate clock in timeit

2011-11-25 Thread Antoine Pitrou
New submission from Antoine Pitrou : This patch uses an accurate POSIX clock if possible in the timeit module. -- components: Library (Lib) files: timeit_clock.patch keywords: patch messages: 148369 nosy: georg.brandl, pitrou priority: normal severity: normal stage: patch review status: