bpo-31415: Add _PyTime_GetPerfCounter() and use it for -X importtime (#3936)
* Add _PyTime_GetPerfCounter()
* Use _PyTime_GetPerfCounter() for -X importtime
diff --git a/Python/import.c b/Python/import.c
index 7554bf8..d396b4d 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1695,7 +1695,7 @@
if (ximporttime) {
import_level++;
- t1 = _PyTime_GetMonotonicClock();
+ t1 = _PyTime_GetPerfCounter();
accumulated = 0;
}
@@ -1711,7 +1711,7 @@
mod != NULL);
if (ximporttime) {
- _PyTime_t cum = _PyTime_GetMonotonicClock() - t1;
+ _PyTime_t cum = _PyTime_GetPerfCounter() - t1;
import_level--;
fprintf(stderr, "import time: %9ld | %10ld | %*s%s\n",