[issue41303] perf_counter result does not count system sleep time in Mac OS

Ronald Oussoren report at bugs.python.org
Thu Aug 6 05:51:48 EDT 2020


Ronald Oussoren <ronaldoussoren at mac.com> added the comment:

mach_absolute_time returns time in ticks, there's a separate API that returns the resolution of this clock (which is already used).

The manpage explicitly says that mach_absolute_time and CLOCK_UPTIME_RAW are the same clock:

     CLOCK_UPTIME_RAW   clock that increments monotonically, in the same manner as CLOCK_MONOTONIC_RAW, but that does
                        not increment while the system is asleep.  The returned value is identical to the result of
                        mach_absolute_time() after the appropriate mach_timebase conversion is applied.

Switching from mach_absolute_time to CLOCK_UPTIME_RAW would therefore bring us no improvements, and would complicate the code base because clock_gettime is only available starting from macOS 10.12.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41303>
_______________________________________


More information about the Python-bugs-list mailing list