I have some questions about the new functions time.perf_counter()
and time.process_time()
.
For the former, from the documentation:
Return the value (in fractional seconds) of a performance counter, i.e. a clock with the highest available resolution to measure a short 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.
Is this 'highest resolution' the same on all systems? Or does it always slightly depend if, for example, we use linux or windows?
The question comes from the fact the reading the documentation of time.time()
it says that 'not all systems provide time with a better precision than 1 second' so how can they provide a better and higher resolution now?
About the latter, time.process_time()
:
Return the value (in fractional seconds) of the sum of the system and user CPU time of the current process. It does not include time elapsed during sleep. It is process-wide by definition. The reference point of the returned value is undefined, so that only the difference between the results of consecutive calls is valid.
I don't understand, what are those 'system time' and 'user CPU time'? What's the difference?