From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>,
Peter Zijlstra <peterz@infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH tip 2/3] perf_counter tools: Add --comms parameter to 'perf report'
Date: Tue, 30 Jun 2009 17:41:59 -0300 [thread overview]
Message-ID: <20090630204159.GC15682@ghostprotocols.net> (raw)
So that we can filter by comm. Symbols in other comms won't be accounted
for.
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-report.txt | 4 +++
tools/perf/builtin-report.c | 31 +++++++++++++++++++++--------
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 13d85ca..4c44ef1 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -24,6 +24,10 @@ OPTIONS
--dsos=::
Only consider symbols in these dsos. CSV that understands
file://filename entries.
+-C::
+--comms=::
+ Only consider symbols in these comms. CSV that understands
+ file://filename entries.
SEE ALSO
--------
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 7c6b6e7..60bdcd9 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -33,8 +33,8 @@ static char *vmlinux = NULL;
static char default_sort_order[] = "comm,dso";
static char *sort_order = default_sort_order;
-static char *dso_list_str;
-static struct strlist *dso_list;
+static char *dso_list_str, *comm_list_str;
+static struct strlist *dso_list, *comm_list;
static int input;
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
@@ -1253,6 +1253,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
return -1;
}
+ if (comm_list && !strlist__has_entry(comm_list, thread->comm))
+ return 0;
+
if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
show = SHOW_KERNEL;
level = 'k';
@@ -1667,6 +1670,8 @@ static const struct option options[] = {
OPT_BOOLEAN('c', "callchain", &callchain, "Display callchains"),
OPT_STRING('d', "dsos", &dso_list_str, "dso[,dso...]",
"only consider symbols in these dsos"),
+ OPT_STRING('C', "comms", &comm_list_str, "comm[,comm...]",
+ "only consider symbols in these comms"),
OPT_END()
};
@@ -1685,6 +1690,19 @@ static void setup_sorting(void)
free(str);
}
+static void setup_list(struct strlist **list, const char *list_str,
+ const char *list_name)
+{
+ if (list_str) {
+ *list = strlist__new(true, list_str);
+ if (!*list) {
+ fprintf(stderr, "problems parsing %s list\n",
+ list_name);
+ exit(129);
+ }
+ }
+}
+
int cmd_report(int argc, const char **argv, const char *prefix)
{
symbol__init();
@@ -1706,13 +1724,8 @@ int cmd_report(int argc, const char **argv, const char *prefix)
if (argc)
usage_with_options(report_usage, options);
- if (dso_list_str) {
- dso_list = strlist__new(true, dso_list_str);
- if (!dso_list) {
- fprintf(stderr, "problems parsing dso list\n");
- exit(129);
- }
- }
+ setup_list(&dso_list, dso_list_str, "dso");
+ setup_list(&comm_list, comm_list_str, "comm");
setup_pager();
--
1.6.2.5
next reply other threads:[~2009-06-30 20:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 20:41 Arnaldo Carvalho de Melo [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-06-30 22:01 [PATCH 0/3] perf_counter tools: filter by comm, dso & symbol lists Linux Kernel Mailing List <linux-kernel@vger.kernel.org> Arnaldo Carvalho de Melo
2009-06-30 22:01 ` [PATCH tip 1/3] perf_counter tools: Add --dsos parameter to 'perf report' Arnaldo Carvalho de Melo
2009-06-30 22:01 ` [PATCH tip 2/3] perf_counter tools: Add --comms " Arnaldo Carvalho de Melo
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=20090630204159.GC15682@ghostprotocols.net \
--to=acme@redhat.com \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
/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