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 vstinner
Recipients giampaolo.rodola, lemburg, pitrou, vstinner
Date 2012-04-04.23:43:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1333583031.1.0.766068719154.issue14309@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2012-04-04 23:43:51vstinnersetrecipients: + vstinner, lemburg, pitrou, giampaolo.rodola
2012-04-04 23:43:51vstinnersetmessageid: <1333583031.1.0.766068719154.issue14309@psf.upfronthosting.co.za>
2012-04-04 23:43:50vstinnerlinkissue14309 messages
2012-04-04 23:43:50vstinnercreate