Importlib was instrumented with two dtrace probes to profile import timing.
Signed-off-by: Christian Heimes <christian@python.org>
Fires when the Python interpreter finishes a garbage collection
cycle. ``arg0`` is the number of collected objects.
+.. c:function:: import__find__load__start(str modulename)
+
+ Fires before :mod:`importlib` attempts to find and load the module.
+ ``arg0`` is the module name.
+
+.. c:function:: import__find__load__done(str modulename, int found)
+
+ Fires after :mod:`importlib`'s find_and_load function is called.
+ ``arg0`` is the module name, ``arg1`` indicates if module was
+ successfully loaded.
+
SystemTap Tapsets
-----------------
probe line(const char *, const char *, int);
probe gc__start(int);
probe gc__done(long);
+ probe import__find__load__start(const char *);
+ probe import__find__load__done(const char *, int);
};
#pragma D attributes Evolving/Evolving/Common provider python provider
static inline void PyDTrace_INSTANCE_NEW_DONE(int arg0) {}
static inline void PyDTrace_INSTANCE_DELETE_START(int arg0) {}
static inline void PyDTrace_INSTANCE_DELETE_DONE(int arg0) {}
+static inline void PyDTrace_IMPORT_FIND_LOAD_START(const char *arg0) {}
+static inline void PyDTrace_IMPORT_FIND_LOAD_DONE(const char *arg0, int arg1) {}
static inline int PyDTrace_LINE_ENABLED(void) { return 0; }
static inline int PyDTrace_FUNCTION_ENTRY_ENABLED(void) { return 0; }
static inline int PyDTrace_INSTANCE_NEW_DONE_ENABLED(void) { return 0; }
static inline int PyDTrace_INSTANCE_DELETE_START_ENABLED(void) { return 0; }
static inline int PyDTrace_INSTANCE_DELETE_DONE_ENABLED(void) { return 0; }
+static inline int PyDTrace_IMPORT_FIND_LOAD_START_ENABLED(void) { return 0; }
+static inline int PyDTrace_IMPORT_FIND_LOAD_DONE_ENABLED(void) { return 0; }
#endif /* !WITH_DTRACE */
--- /dev/null
+Importlib was instrumented with two dtrace probes to profile import timing.
#include "frameobject.h"
#include "osdefs.h"
#include "importdl.h"
+#include "pydtrace.h"
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
}
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;
}