From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] trace-cmd: Have trace-cmd record -c set function-fork option if exists
Date: Mon, 2 Mar 2020 13:03:36 -0500 [thread overview]
Message-ID: <20200302130336.4b6c63e5@gandalf.local.home> (raw)
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
If the function-fork option exists on the machine, then it should be set if
'-c' is added to trace-cmd record. Othrewise the function tracers will not
trace the children of the process it is recording.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
tracecmd/trace-record.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 0a3851ad..2866b776 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -128,6 +128,7 @@ static int len_filter_pids;
static int have_set_event_pid;
static int have_event_fork;
+static int have_func_fork;
struct opt_list {
struct opt_list *next;
@@ -354,6 +355,14 @@ static void test_set_event_pid(void)
}
tracefs_put_tracing_file(path);
+ path = tracefs_get_tracing_file("options/function-fork");
+ ret = stat(path, &st);
+ if (!ret) {
+ have_func_fork = 1;
+ reset_save_file(path, RESET_DEFAULT_PRIO);
+ }
+ tracefs_put_tracing_file(path);
+
tested = 1;
}
@@ -5595,6 +5604,8 @@ static void parse_record_options(int argc,
save_option("event-fork");
ctx->do_child = 1;
}
+ if (have_func_fork)
+ save_option("function-fork");
break;
case 'C':
ctx->instance->clock = optarg;
--
2.20.1
reply other threads:[~2020-03-02 18:03 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=20200302130336.4b6c63e5@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).