diff options
author | Christian Heimes <christian@python.org> | 2017-09-29 22:53:19 (GMT) |
---|---|---|
committer | Ćukasz Langa <lukasz@langa.pl> | 2017-09-29 22:53:19 (GMT) |
commit | 3d2b407da048b14ba6e5eb6079722a785d210590 (patch) | |
tree | 1103d0c570ee9d08b938b783a2731ef50a7bd830 /Python/import.c | |
parent | 574562c5ddb2f0429aab9af762442e6f9a3f26ab (diff) | |
download | cpython-3d2b407da048b14ba6e5eb6079722a785d210590.zip cpython-3d2b407da048b14ba6e5eb6079722a785d210590.tar.gz cpython-3d2b407da048b14ba6e5eb6079722a785d210590.tar.bz2 |
bpo-31574: importlib dtrace (#3749)
Importlib was instrumented with two dtrace probes to profile import timing.
Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c index 5e841ca..e50ea4d 100644 --- a/Python/import.c +++ b/Python/import.c @@ -12,6 +12,7 @@ #include "frameobject.h" #include "osdefs.h" #include "importdl.h" +#include "pydtrace.h" #ifdef HAVE_FCNTL_H #include <fcntl.h> @@ -1667,9 +1668,18 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, } else { Py_XDECREF(mod); + + if (PyDTrace_IMPORT_FIND_LOAD_START_ENABLED()) + PyDTrace_IMPORT_FIND_LOAD_START(PyUnicode_AsUTF8(abs_name)); + mod = _PyObject_CallMethodIdObjArgs(interp->importlib, &PyId__find_and_load, abs_name, interp->import_func, NULL); + + if (PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED()) + PyDTrace_IMPORT_FIND_LOAD_DONE(PyUnicode_AsUTF8(abs_name), + mod != NULL); + if (mod == NULL) { goto error; } |