bpo-31415: Add _PyTime_GetPerfCounter() and use it for -X importtime (#3936)

* Add _PyTime_GetPerfCounter()
* Use _PyTime_GetPerfCounter() for -X importtime
This commit is contained in:
Victor Stinner 2017-10-10 02:51:50 -07:00 committed by GitHub
parent 14aa00b519
commit a997c7b434
4 changed files with 112 additions and 60 deletions

View file

@ -1695,7 +1695,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals,
if (ximporttime) {
import_level++;
t1 = _PyTime_GetMonotonicClock();
t1 = _PyTime_GetPerfCounter();
accumulated = 0;
}
@ -1711,7 +1711,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals,
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",