Commit aa07df6e authored by David Ahern's avatar David Ahern Committed by Arnaldo Carvalho de Melo

perf trace: Update tid/pid filtering option to leverage symbol_conf

Leverage pid/tid filtering done by symbol_conf hooks.
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Link: http://lkml.kernel.org/r/1480091392-35645-1-git-send-email-dsa@cumulusnetworks.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 350f54fa
...@@ -74,8 +74,6 @@ struct trace { ...@@ -74,8 +74,6 @@ struct trace {
size_t nr; size_t nr;
int *entries; int *entries;
} ev_qualifier_ids; } ev_qualifier_ids;
struct intlist *tid_list;
struct intlist *pid_list;
struct { struct {
size_t nr; size_t nr;
pid_t *entries; pid_t *entries;
...@@ -1890,18 +1888,6 @@ static int trace__pgfault(struct trace *trace, ...@@ -1890,18 +1888,6 @@ static int trace__pgfault(struct trace *trace,
return err; return err;
} }
static bool skip_sample(struct trace *trace, struct perf_sample *sample)
{
if ((trace->pid_list && intlist__find(trace->pid_list, sample->pid)) ||
(trace->tid_list && intlist__find(trace->tid_list, sample->tid)))
return false;
if (trace->pid_list || trace->tid_list)
return true;
return false;
}
static void trace__set_base_time(struct trace *trace, static void trace__set_base_time(struct trace *trace,
struct perf_evsel *evsel, struct perf_evsel *evsel,
struct perf_sample *sample) struct perf_sample *sample)
...@@ -1926,11 +1912,13 @@ static int trace__process_sample(struct perf_tool *tool, ...@@ -1926,11 +1912,13 @@ static int trace__process_sample(struct perf_tool *tool,
struct machine *machine __maybe_unused) struct machine *machine __maybe_unused)
{ {
struct trace *trace = container_of(tool, struct trace, tool); struct trace *trace = container_of(tool, struct trace, tool);
struct thread *thread;
int err = 0; int err = 0;
tracepoint_handler handler = evsel->handler; tracepoint_handler handler = evsel->handler;
if (skip_sample(trace, sample)) thread = machine__findnew_thread(trace->host, sample->pid, sample->tid);
if (thread && thread__is_filtered(thread))
return 0; return 0;
trace__set_base_time(trace, evsel, sample); trace__set_base_time(trace, evsel, sample);
...@@ -1943,27 +1931,6 @@ static int trace__process_sample(struct perf_tool *tool, ...@@ -1943,27 +1931,6 @@ static int trace__process_sample(struct perf_tool *tool,
return err; return err;
} }
static int parse_target_str(struct trace *trace)
{
if (trace->opts.target.pid) {
trace->pid_list = intlist__new(trace->opts.target.pid);
if (trace->pid_list == NULL) {
pr_err("Error parsing process id string\n");
return -EINVAL;
}
}
if (trace->opts.target.tid) {
trace->tid_list = intlist__new(trace->opts.target.tid);
if (trace->tid_list == NULL) {
pr_err("Error parsing thread id string\n");
return -EINVAL;
}
}
return 0;
}
static int trace__record(struct trace *trace, int argc, const char **argv) static int trace__record(struct trace *trace, int argc, const char **argv)
{ {
unsigned int rec_argc, i, j; unsigned int rec_argc, i, j;
...@@ -2460,6 +2427,12 @@ static int trace__replay(struct trace *trace) ...@@ -2460,6 +2427,12 @@ static int trace__replay(struct trace *trace)
if (session == NULL) if (session == NULL)
return -1; return -1;
if (trace->opts.target.pid)
symbol_conf.pid_list_str = strdup(trace->opts.target.pid);
if (trace->opts.target.tid)
symbol_conf.tid_list_str = strdup(trace->opts.target.tid);
if (symbol__init(&session->header.env) < 0) if (symbol__init(&session->header.env) < 0)
goto out; goto out;
...@@ -2503,10 +2476,6 @@ static int trace__replay(struct trace *trace) ...@@ -2503,10 +2476,6 @@ static int trace__replay(struct trace *trace)
evsel->handler = trace__pgfault; evsel->handler = trace__pgfault;
} }
err = parse_target_str(trace);
if (err != 0)
goto out;
setup_pager(); setup_pager();
err = perf_session__process_events(session); err = perf_session__process_events(session);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment