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:
Christian Heimes 2017-09-30 00:53:19 +02:00 committed by Łukasz Langa
parent 574562c5dd
commit 3d2b407da0
5 changed files with 28 additions and 0 deletions

View file

@ -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;
}