aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-06-30 18:01:21 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-30 18:07:10 -0400
commitcc8b88b15ab8e5ae162a46c4b6b286b555190dd1 (patch)
tree39e60424a356ef9225820773408b2c1117ecbf93 /tools/perf/builtin-report.c
parent25903407da21552419e0955705d6d8c8e601cb2e (diff)
perf report: Add --comms parameter
So that we can filter by comm. Symbols in other comms won't be accounted for. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1246399282-20934-3-git-send-email-acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 7c6b6e776718..8143477b7ef7 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -33,8 +33,8 @@ static char *vmlinux = NULL;
33 33
34static char default_sort_order[] = "comm,dso"; 34static char default_sort_order[] = "comm,dso";
35static char *sort_order = default_sort_order; 35static char *sort_order = default_sort_order;
36static char *dso_list_str; 36static char *dso_list_str, *comm_list_str;
37static struct strlist *dso_list; 37static struct strlist *dso_list, *comm_list;
38 38
39static int input; 39static int input;
40static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; 40static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
@@ -240,7 +240,7 @@ static u64 vdso__map_ip(struct map *map, u64 ip)
240 240
241static inline int is_anon_memory(const char *filename) 241static inline int is_anon_memory(const char *filename)
242{ 242{
243 return strcmp(filename, "//anon") == 0; 243 return strcmp(filename, "//anon") == 0;
244} 244}
245 245
246static struct map *map__new(struct mmap_event *event) 246static struct map *map__new(struct mmap_event *event)
@@ -1253,6 +1253,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
1253 return -1; 1253 return -1;
1254 } 1254 }
1255 1255
1256 if (comm_list && !strlist__has_entry(comm_list, thread->comm))
1257 return 0;
1258
1256 if (event->header.misc & PERF_EVENT_MISC_KERNEL) { 1259 if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
1257 show = SHOW_KERNEL; 1260 show = SHOW_KERNEL;
1258 level = 'k'; 1261 level = 'k';
@@ -1667,6 +1670,8 @@ static const struct option options[] = {
1667 OPT_BOOLEAN('c', "callchain", &callchain, "Display callchains"), 1670 OPT_BOOLEAN('c', "callchain", &callchain, "Display callchains"),
1668 OPT_STRING('d', "dsos", &dso_list_str, "dso[,dso...]", 1671 OPT_STRING('d', "dsos", &dso_list_str, "dso[,dso...]",
1669 "only consider symbols in these dsos"), 1672 "only consider symbols in these dsos"),
1673 OPT_STRING('C', "comms", &comm_list_str, "comm[,comm...]",
1674 "only consider symbols in these comms"),
1670 OPT_END() 1675 OPT_END()
1671}; 1676};
1672 1677
@@ -1685,6 +1690,19 @@ static void setup_sorting(void)
1685 free(str); 1690 free(str);
1686} 1691}
1687 1692
1693static void setup_list(struct strlist **list, const char *list_str,
1694 const char *list_name)
1695{
1696 if (list_str) {
1697 *list = strlist__new(true, list_str);
1698 if (!*list) {
1699 fprintf(stderr, "problems parsing %s list\n",
1700 list_name);
1701 exit(129);
1702 }
1703 }
1704}
1705
1688int cmd_report(int argc, const char **argv, const char *prefix) 1706int cmd_report(int argc, const char **argv, const char *prefix)
1689{ 1707{
1690 symbol__init(); 1708 symbol__init();
@@ -1706,13 +1724,8 @@ int cmd_report(int argc, const char **argv, const char *prefix)
1706 if (argc) 1724 if (argc)
1707 usage_with_options(report_usage, options); 1725 usage_with_options(report_usage, options);
1708 1726
1709 if (dso_list_str) { 1727 setup_list(&dso_list, dso_list_str, "dso");
1710 dso_list = strlist__new(true, dso_list_str); 1728 setup_list(&comm_list, comm_list_str, "comm");
1711 if (!dso_list) {
1712 fprintf(stderr, "problems parsing dso list\n");
1713 exit(129);
1714 }
1715 }
1716 1729
1717 setup_pager(); 1730 setup_pager();
1718 1731