Charles-François Natali <neolo...@free.fr> 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(1); print(clock_gettime(id) - t)"
1.0011036396026611
$ ./python -c "from time import *; id = CLOCK_PROCESS_CPUTIME_ID; t = 
clock_gettime(id); sleep(1); print(clock_gettime(id) - t)"
9.480300000003217e-05

Right now, timeit measures wall-clock time:
"""
On either platform, the default timer functions measure wall clock time, not 
the CPU time. [...] On Unix, you can use clock() to measure CPU time.
"""

With CLOCK_PROCESS_CPUTIME_ID:
- depending on the platform, we'll measure either wall-clock time or CPU time
- preemtion, blocking syscalls, etc won't be accounted for (so, for example, 
I/O-related tests will be meaningless)

----------
nosy: +neologix

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13481>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to