[issue14309] Deprecate time.clock()
STINNER Victor
report at bugs.python.org
Thu Apr 5 01:43:51 CEST 2012
STINNER Victor <victor.stinner at gmail.com> added the comment:
I misunderstood the time.clock() function. It counts the CPU time while the process is active, whereas a monotonic clock counts elapsed time even during a sleep. time.clock() and time.monotonic() are different clocks for different purposes.
I wrote the PEP 418 which contains a list of all available OS clocks. It lists monotonic clocks, but also "process time" and "thread time" clocks. And it has a "Deferred API: time.perf_counter()" section.
Something can be done to provide portable functions to get the user and system times. See for example Tools/pybench/systimes.py written by Marc-Andre Lemburg.
Python 3.3 gives access to clock_gettime(CLOCK_PROCESS_CPUTIME_ID) and clock_gettime(CLOCK_THREAD_CPUTIME_ID).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14309>
_______________________________________
More information about the Python-bugs-list
mailing list