[issue37859] time.process_time() constant / erratic on Windows

Eryk Sun report at bugs.python.org
Wed Aug 14 17:45:26 EDT 2019


Eryk Sun <eryksun at gmail.com> added the comment:

> I suppose it may benefit from a more precise counter, but since in 
> Windows it also has a precise counter with time.perf_counter_ns(), 
> I was expecting to see that value change, but it was mainly a 
> confusion with the older time.clock().

Don't read too much into the clock info here:

    >>> time.get_clock_info('process_time').resolution
    1e-07

Process times [1] are stored as a 64-bit integer in units of 100 ns (1e-7). But the kernel schedules threads based on a timer that ticks every 15.625 ms by default. It can be lowered to about 0.5 ms, but this degrades battery life.

[1] https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes

----------
nosy: +eryksun

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


More information about the Python-bugs-list mailing list