[Python-Dev] PEP 564: Add new time functions with nanosecond resolution (original) (raw)

Victor Stinner victor.stinner at gmail.com
Tue Oct 17 18:05:24 EDT 2017


Antoine Pitrou:

Why not time.processtimens()?

I measured the minimum delta between two clock reads, ignoring zeros. I tested time.process_time(), os.times(), resource.getrusage(), and their nanosecond variants (with my WIP implementation of the PEP 564).

Linux:

Windows:

Note: I didn't test os.wait3() and os.wait4(), but they also use the ru_usage structure and so probably also have a resolution of 1 us.

It looks like currently, only time.process_time() has a resolution in nanoseconds (smaller than 1 us). I propose to only add time.process_time_ns(), as you proposed.

We might add nanosecond variant for the other functions once operating systems will add new functions with better resolution.

Victor



More information about the Python-Dev mailing list