mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
bpo-31574: importlib dtrace (#3749)
Importlib was instrumented with two dtrace probes to profile import timing. Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
574562c5dd
commit
3d2b407da0
5 changed files with 28 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue