@@ -2315,6 +2315,38 @@ struct tep_event *dynevent_get_event(PyDynevent *event,
return tep_evt;
}
+PyObject *PyFtrace_eprobe(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = {"event", "target_system", "target_event", "fetchargs", NULL};
+ const char *event, *target_system, *target_event, *fetchargs;
+ struct tracefs_dynevent *eprobe;
+
+ if (!PyArg_ParseTupleAndKeywords(args,
+ kwargs,
+ "ssss",
+ kwlist,
+ &event,
+ &target_system,
+ &target_event,
+ &fetchargs)) {
+ return NULL;
+ }
+
+ eprobe = tracefs_eprobe_alloc(TC_SYS, event, target_system, target_event, fetchargs);
+ if (!eprobe) {
+ MEM_ERROR;
+ return NULL;
+ }
+
+ if (tracefs_dynevent_create(eprobe) < 0) {
+ TfsError_fmt(NULL, "Failed to create eprobe '%s'", event);
+ tracefs_dynevent_free(eprobe);
+ return NULL;
+ }
+
+ return PyDynevent_New(eprobe);
+}
+
static PyObject *set_filter(PyObject *args, PyObject *kwargs,
struct tep_handle *tep,
struct tep_event *event)
@@ -251,6 +251,8 @@ PyObject *PyFtrace_register_kprobe(PyObject *self, PyObject *args,
PyObject *PyFtrace_register_kretprobe(PyObject *self, PyObject *args,
PyObject *kwargs);
+PyObject *PyFtrace_eprobe(PyObject *self, PyObject *args, PyObject *kwargs);
+
PyObject *PyFtrace_hist(PyObject *self, PyObject *args,
PyObject *kwargs);
@@ -460,6 +460,11 @@ static PyMethodDef ftracepy_methods[] = {
METH_VARARGS | METH_KEYWORDS,
"Define a kretprobe."
},
+ {"eprobe",
+ (PyCFunction) PyFtrace_eprobe,
+ METH_VARARGS | METH_KEYWORDS,
+ "Define an eprobe."
+ },
{"hist",
(PyCFunction) PyFtrace_hist,
METH_VARARGS | METH_KEYWORDS,
Event probe (eprobe) is a new type of ftrace dynamic events, introduced in the Linux kernel 5.15 version. It is useful to have support for it in trace-cruncher, as it allows more flexibility when printing event's data. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- src/ftracepy-utils.c | 32 ++++++++++++++++++++++++++++++++ src/ftracepy-utils.h | 2 ++ src/ftracepy.c | 5 +++++ 3 files changed, 39 insertions(+)