[Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions (original) (raw)

Victor Stinner victor.stinner at gmail.com
Mon Apr 16 01:25:42 CEST 2012


time.perfcounter() ^^^^^^^^^^^^^^^^^^^

Performance counter with the highest available precision to measure a duration.  It does include time elapsed during sleep and is system-wide.  The reference point of the returned value is undefined, so that only the difference between the results of consecutive calls is valid and is a number of seconds.

It's maybe time for bikeshedding! Glyph wrote me in private: "IMHO, perf_counter should be performance_counter() or high_precision(); the abbreviation is silly :)"

The time module has other abbreviated names. I don't have a preference between time.perf_counter() or time.performance_counter().

Solaris provides CLOCK_HIGHRES, "the nonadjustable, high-resolution clock." If we map CLOCK_xxx names to functions name, we have:

(whereas Windows provides QueryPerformanceCounter -> performance_counter)

I suppose that most people don't care that "resolution" and "precision" are different things.

Victor



More information about the Python-Dev mailing list