[PATCH v3 6/7] perf python: Add evlist close support
From: Ian Rogers
Date: Mon May 19 2025 - 15:53:41 EST
From: Gautam Menghani <gautam@xxxxxxxxxxxxx>
Add support for the evlist close function.
Signed-off-by: Gautam Menghani <gautam@xxxxxxxxxxxxx>
---
tools/perf/util/python.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 281e706e102d..cca744d51349 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -1210,6 +1210,16 @@ static PyObject *pyrf_evlist__open(struct pyrf_evlist *pevlist,
return Py_None;
}
+static PyObject *pyrf_evlist__close(struct pyrf_evlist *pevlist)
+{
+ struct evlist *evlist = &pevlist->evlist;
+
+ evlist__close(evlist);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static PyObject *pyrf_evlist__config(struct pyrf_evlist *pevlist)
{
struct record_opts opts = {
@@ -1268,6 +1278,12 @@ static PyMethodDef pyrf_evlist__methods[] = {
.ml_flags = METH_VARARGS | METH_KEYWORDS,
.ml_doc = PyDoc_STR("open the file descriptors.")
},
+ {
+ .ml_name = "close",
+ .ml_meth = (PyCFunction)pyrf_evlist__close,
+ .ml_flags = METH_NOARGS,
+ .ml_doc = PyDoc_STR("close the file descriptors.")
+ },
{
.ml_name = "poll",
.ml_meth = (PyCFunction)pyrf_evlist__poll,
--
2.49.0.1101.gccaa498523-goog