aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-trace.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-02-21 10:15:21 -0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-02-22 22:14:48 -0300
commit241b057ce5c01a24c280f124fab60109cb562589 (patch)
tree55fe41058ebbbe8da2ea6f11f9e25777eeaf1dc3 /tools/perf/builtin-trace.c
parentperf evlist: Introduce set_filter_pid method (diff)
downloadlinux-dev-241b057ce5c01a24c280f124fab60109cb562589.tar.xz
linux-dev-241b057ce5c01a24c280f124fab60109cb562589.zip
perf trace: Filter out the trace pid when no threads are specified
To avoid tracing the tracer. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-shmwd1khzpaobr3i0j1ygapg@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r--tools/perf/builtin-trace.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 3a696aa70630..cb33e4c8821a 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2151,6 +2151,15 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
if (err < 0)
goto out_error_open;
+ /*
+ * Better not use !target__has_task() here because we need to cover the
+ * case where no threads were specified in the command line, but a
+ * workload was, and in that case we will fill in the thread_map when
+ * we fork the workload in perf_evlist__prepare_workload.
+ */
+ if (evlist->threads->map[0] == -1)
+ perf_evlist__set_filter_pid(evlist, getpid());
+
err = perf_evlist__mmap(evlist, trace->opts.mmap_pages, false);
if (err < 0)
goto out_error_mmap;