[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181205160509.1168-5-jolsa@kernel.org>
Date: Wed, 5 Dec 2018 17:05:05 +0100
From: Jiri Olsa <jolsa@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
"Luis Claudio R. Goncalves" <lclaudio@...g.org>, ldv@...linux.org,
esyr@...hat.com, Frederic Weisbecker <fweisbec@...il.com>
Subject: [PATCH 4/8] perf trace: Add --block option
Adding --block option to allow trace command pass along
the --block option for record command or to set it for
trace run session, like:
# perf trace --block kill
# perf trace --block -p ...
# perf trace -e raw_syscalls:sys_enter --block -p ...
It's allowed only for syscall tracepoint events
attached to process.
Link: http://lkml.kernel.org/n/tip-ocz7zwwkkx11v0mkxrtcddih@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
tools/perf/builtin-trace.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index a57a9ae1fd4b..a663ec346a8e 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2379,10 +2379,12 @@ static int trace__record(struct trace *trace, int argc, const char **argv)
unsigned int majpf_args_nr = ARRAY_SIZE(majpf_args);
const char * const minpf_args[] = { "-e", "minor-faults" };
unsigned int minpf_args_nr = ARRAY_SIZE(minpf_args);
+ const char * const block_args[] = { "--block", };
+ unsigned int block_args_nr = ARRAY_SIZE(block_args);
/* +1 is for the event string below */
rec_argc = ARRAY_SIZE(record_args) + sc_args_nr + 1 +
- majpf_args_nr + minpf_args_nr + argc;
+ majpf_args_nr + minpf_args_nr + block_args_nr + argc;
rec_argv = calloc(rec_argc + 1, sizeof(char *));
if (rec_argv == NULL)
@@ -2416,6 +2418,9 @@ static int trace__record(struct trace *trace, int argc, const char **argv)
for (i = 0; i < minpf_args_nr; i++)
rec_argv[j++] = minpf_args[i];
+ if (trace->opts.block)
+ rec_argv[j++] = block_args[0];
+
for (i = 0; i < (unsigned int)argc; i++)
rec_argv[j++] = argv[i];
@@ -3409,6 +3414,8 @@ int cmd_trace(int argc, const char **argv)
trace__parse_events_option),
OPT_BOOLEAN(0, "comm", &trace.show_comm,
"show the thread COMM next to its id"),
+ OPT_BOOLEAN(0, "block", &trace.opts.block,
+ "Request blocked tracing (for syscall tracepoints)"),
OPT_BOOLEAN(0, "tool_stats", &trace.show_tool_stats, "show tool stats"),
OPT_CALLBACK(0, "expr", &trace, "expr", "list of syscalls/events to trace",
trace__parse_events_option),
@@ -3500,6 +3507,14 @@ int cmd_trace(int argc, const char **argv)
"cgroup monitoring only available in system-wide mode");
}
+ if (trace.opts.block) {
+ if (!target__has_task(&trace.opts.target) &&
+ !target__none(&trace.opts.target)) {
+ pr_err("ERROR: Can't use --block on non task targets\n");
+ goto out;
+ }
+ }
+
evsel = bpf__setup_output_event(trace.evlist, "__augmented_syscalls__");
if (IS_ERR(evsel)) {
bpf__strerror_setup_output_event(trace.evlist, PTR_ERR(evsel), bf, sizeof(bf));
--
2.17.2
Powered by blists - more mailing lists