From: tip-bot for Arnaldo Carvalho de Melo <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@kernel.org, jolsa@redhat.com, tglx@linutronix.de,
fweisbec@gmail.com, mingo@kernel.org, adrian.hunter@intel.com,
dsahern@gmail.com, eranian@google.com, dzickus@redhat.com,
peterz@infradead.org, efault@gmx.de, hpa@zytor.com,
linux-kernel@vger.kernel.org, bp@suse.de, acme@redhat.com
Subject: [tip:perf/core] perf evlist: Introduce set_filter_pid method
Date: Thu, 26 Feb 2015 03:31:31 -0800 [thread overview]
Message-ID: <tip-byoia9dzu4gmkdv87etnd9zf@git.kernel.org> (raw)
Commit-ID: cfd70a26aadf0a9af80bbce035e5760736727a94
Gitweb: http://git.kernel.org/tip/cfd70a26aadf0a9af80bbce035e5760736727a94
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Sat, 21 Feb 2015 10:09:55 -0800
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Sun, 22 Feb 2015 22:14:25 -0300
perf evlist: Introduce set_filter_pid method
To filter out events for a certain pid, for instance, when tracing
system wide, so that the tracer itself doesn't creates an event loop.
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-byoia9dzu4gmkdv87etnd9zf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evlist.c | 13 +++++++++++++
tools/perf/util/evlist.h | 1 +
2 files changed, 14 insertions(+)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index a8b2c57..39302a4 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1085,6 +1085,19 @@ int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter)
return err;
}
+int perf_evlist__set_filter_pid(struct perf_evlist *evlist, pid_t pid)
+{
+ char *filter;
+ int ret;
+
+ if (asprintf(&filter, "common_pid != %d", pid) < 0)
+ return -1;
+
+ ret = perf_evlist__set_filter(evlist, filter);
+ free(filter);
+ return ret;
+}
+
bool perf_evlist__valid_sample_type(struct perf_evlist *evlist)
{
struct perf_evsel *pos;
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index c94a9e0..715fa3a 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -77,6 +77,7 @@ int perf_evlist__add_newtp(struct perf_evlist *evlist,
const char *sys, const char *name, void *handler);
int perf_evlist__set_filter(struct perf_evlist *evlist, const char *filter);
+int perf_evlist__set_filter_pid(struct perf_evlist *evlist, pid_t pid);
struct perf_evsel *
perf_evlist__find_tracepoint_by_id(struct perf_evlist *evlist, int id);
reply other threads:[~2015-02-26 11:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-byoia9dzu4gmkdv87etnd9zf@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=bp@suse.de \
--cc=dsahern@gmail.com \
--cc=dzickus@redhat.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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