An optional parameter 'sort' is added. If set to True, the returned list of event names is sorted in alphabetical order. The default value of 'sort' is False. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx> --- src/ftracepy-utils.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ftracepy-utils.c b/src/ftracepy-utils.c index 0fcadd8..f884106 100644 --- a/src/ftracepy-utils.c +++ b/src/ftracepy-utils.c @@ -733,18 +733,20 @@ PyObject *PyFtrace_available_event_systems(PyObject *self, PyObject *args, PyObject *PyFtrace_available_system_events(PyObject *self, PyObject *args, PyObject *kwargs) { - static char *kwlist[] = {"system", "instance", NULL}; + static char *kwlist[] = {"system", "instance", "sort", NULL}; struct tracefs_instance *instance; PyObject *py_inst = NULL; const char *system; + int sort = false; char **list; if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "s|O", + "s|Op", kwlist, &system, - &py_inst)) { + &py_inst, + &sort)) { return NULL; } @@ -757,7 +759,7 @@ PyObject *PyFtrace_available_system_events(PyObject *self, PyObject *args, if (!list) return NULL; - return tfs_list2py_list(list, false); + return tfs_list2py_list(list, sort); } bool get_event_enable_file(struct tracefs_instance *instance, -- 2.30.2