linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] libtracefs: Load ftrace events in fill_local_events_systems()
Date: Fri, 4 Dec 2020 17:01:19 -0500	[thread overview]
Message-ID: <20201204170119.220692d8@gandalf.local.home> (raw)

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


                 reply	other threads:[~2020-12-04 22:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201204170119.220692d8@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).