mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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:
parent
14aa00b519
commit
a997c7b434
4 changed files with 112 additions and 60 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue