aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <[email protected]>2017-07-20 11:17:51 -0300
committerArnaldo Carvalho de Melo <[email protected]>2017-07-20 11:17:51 -0300
commitdd1a50377c92321f78fa4d0601bb4d88d88670ab (patch)
treee72472617baf72d5f6d9dd147e51a104247737f7
parent15bed2742a8d60210b958963ca1091d3cfc4f332 (diff)
perf trace: Introduce filter_loop_pids()
No change in functionality, just to make clearer that what we want when filtering the tracer pid in a system wide tracing session is to avoid a feedback loop. This also paves the way for a more interesting loop avoidance algorithm, one that tries to figure out if we are in a ssh session, xterm, etc. Cc: Adrian Hunter <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Wang Nan <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/builtin-trace.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 9e74e675d7cb..0ba36f08efd8 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2239,6 +2239,16 @@ out_enomem:
goto out;
}
+static int trace__set_filter_loop_pids(struct trace *trace)
+{
+ int nr = 1;
+ pid_t pids[32] = {
+ getpid(),
+ };
+
+ return perf_evlist__set_filter_pids(trace->evlist, nr, pids);
+}
+
static int trace__run(struct trace *trace, int argc, const char **argv)
{
struct perf_evlist *evlist = trace->evlist;
@@ -2362,7 +2372,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
if (trace->filter_pids.nr > 0)
err = perf_evlist__set_filter_pids(evlist, trace->filter_pids.nr, trace->filter_pids.entries);
else if (thread_map__pid(evlist->threads, 0) == -1)
- err = perf_evlist__set_filter_pid(evlist, getpid());
+ err = trace__set_filter_loop_pids(trace);
if (err < 0)
goto out_error_mem;