* [tip:perf/core] perf trace: Introduce filter_loop_pids()
@ 2017-07-26 17:17 tip-bot for Arnaldo Carvalho de Melo
0 siblings, 0 replies; only message in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2017-07-26 17:17 UTC (permalink / raw)
To: linux-tip-commits
Cc: namhyung, tglx, dsahern, adrian.hunter, hpa, acme, jolsa,
wangnan0, mingo, linux-kernel
Commit-ID: dd1a50377c92321f78fa4d0601bb4d88d88670ab
Gitweb: http://git.kernel.org/tip/dd1a50377c92321f78fa4d0601bb4d88d88670ab
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 20 Jul 2017 11:17:51 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 20 Jul 2017 11:17:51 -0300
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 <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5fcttc5kdjkcyp9404ezkuy9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-trace.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 9e74e67..0ba36f0 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-07-26 17:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-26 17:17 [tip:perf/core] perf trace: Introduce filter_loop_pids() tip-bot for Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome