diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-10-12 15:51:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-12 15:51:56 (GMT) |
commit | cba9a0c6def70549046f1afa6a80e38fe706520e (patch) | |
tree | 1700dda3a2a2170cc5d0766387fe6f020540c44c /Python/import.c | |
parent | 0e61e67a57deb4abc677808201d7cf3c38138e02 (diff) | |
download | cpython-cba9a0c6def70549046f1afa6a80e38fe706520e.zip cpython-cba9a0c6def70549046f1afa6a80e38fe706520e.tar.gz cpython-cba9a0c6def70549046f1afa6a80e38fe706520e.tar.bz2 |
bpo-31773: time.perf_counter() uses again double (GH-3964)
time.clock() and time.perf_counter() now use again C double
internally.
Remove also _PyTime_GetWinPerfCounterWithInfo(): use
_PyTime_GetPerfCounterDoubleWithInfo() instead on Windows.
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/import.c b/Python/import.c index d396b4d..76aa912 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1669,10 +1669,10 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, else { static int ximporttime = 0; static int import_level; - static _PyTime_t accumulated; + static double accumulated; _Py_IDENTIFIER(importtime); - _PyTime_t t1 = 0, accumulated_copy = accumulated; + double t1 = 0, accumulated_copy = accumulated; Py_XDECREF(mod); @@ -1695,7 +1695,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, if (ximporttime) { import_level++; - t1 = _PyTime_GetPerfCounter(); + t1 = _PyTime_GetPerfCounterDouble(); accumulated = 0; } @@ -1711,12 +1711,12 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, mod != NULL); if (ximporttime) { - _PyTime_t cum = _PyTime_GetPerfCounter() - t1; + double cum = _PyTime_GetPerfCounterDouble() - t1; import_level--; fprintf(stderr, "import time: %9ld | %10ld | %*s%s\n", - (long)_PyTime_AsMicroseconds(cum - accumulated, _PyTime_ROUND_CEILING), - (long)_PyTime_AsMicroseconds(cum, _PyTime_ROUND_CEILING), + (long)ceil((cum - accumulated) * 1e6), + (long)ceil(cum * 1e6), import_level*2, "", PyUnicode_AsUTF8(abs_name)); accumulated = accumulated_copy + cum; |