linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libtracefs: Load ftrace events in fill_local_events_systems()
@ 2020-12-04 22:01 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2020-12-04 22:01 UTC (permalink / raw)
  To: Linux Trace Devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

While writing some code that used tracefs to access the tracefs directory,
and to load the tep events, I found that it was missing the ftrace events. I
enabled the userstacktrace option, but found that the tep handler returned
by tracefs_local_events_system() did not contain any ftrace event, and thus
I could not parse the user_stack events.

This was due to the fill_local_events_systems() checking against the list of
system names returned by tracefs_event_systems(), which returns the names of
all the system directories that have an "enable" file in them. As ftrace
events are special, and the directory is only for parsing purposes (not to
enable events), it was skipped due to the lack of an "enable" file.

Instead, after processing all the systems returned by tracefs_event_systems(),
check if the sys_names is NULL or matches "ftrace", and if it does, add the
ftrace events as well.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracefs-events.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tracefs-events.c b/tracefs-events.c
index a792aeb..e2928d9 100644
--- a/tracefs-events.c
+++ b/tracefs-events.c
@@ -564,6 +564,11 @@ static int fill_local_events_system(const char *tracing_dir,
 		if (ret && parsing_failures)
 			(*parsing_failures)++;
 	}
+
+	/* Include ftrace, as it is excluded for not having "enable" file */
+	if (!sys_names || contains("ftrace", sys_names))
+		load_events(tep, tracing_dir, "ftrace");
+
 	/* always succeed because parsing failures are not critical */
 	ret = 0;
 out:
-- 
2.25.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-04 22:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 22:01 [PATCH] libtracefs: Load ftrace events in fill_local_events_systems() Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).