aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-06-30 18:01:22 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-30 18:07:10 -0400
commit7bec7a9134c25cecb0d7029199b59f7b1bef35b8 (patch)
treeea28eb245e00b837e77e5919dfb1acc070ca76af
parentcc8b88b15ab8e5ae162a46c4b6b286b555190dd1 (diff)
perf report: Add --symbols parameter
So that we can filter by symbol name. The 'pfunct' utility in the 'dwarves' package can be used to create a file with the functions one wants. Example: [acme@doppio pahole]$ pfunct /usr/lib/debug/usr/lib64/libdw-0.141.so.debug | grep dwarf > /tmp/dwarf.symbols [acme@doppio pahole]$ wc -l /tmp/dwarf.symbols 93 /tmp/dwarf.symbols [acme@doppio pahole]$ head -3 /tmp/dwarf.symbols dwfl_addrdwarf dwfl_module_getdwarf dwfl_getdwarf [acme@doppio pahole]$ perf report --sort comm,dso,symbol --comms pahole --dsos /usr/lib64/libdw-0.141.so --symbols file:///tmp/dwarf.symbols 33.99% pahole /usr/lib64/libdw-0.141.so [.] dwarf_tag 29.07% pahole /usr/lib64/libdw-0.141.so [.] dwarf_decl_file 27.71% pahole /usr/lib64/libdw-0.141.so [.] dwarf_getsrclines 4.54% pahole /usr/lib64/libdw-0.141.so 0x00000000007400 3.93% pahole /usr/lib64/libdw-0.141.so [.] dwarf_decl_line 0.46% pahole /usr/lib64/libdw-0.141.so [.] dwarf_getlocation 0.18% pahole /usr/lib64/libdw-0.141.so [.] __libdwarf_next_prime 0.13% pahole /usr/lib64/libdw-0.141.so [.] dwarf_diecu [acme@doppio pahole]$ 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-4-git-send-email-acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--tools/perf/Documentation/perf-report.txt4
-rw-r--r--tools/perf/builtin-report.c10
2 files changed, 12 insertions, 2 deletions
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 4c44ef1747b9..8aa3f8c88707 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -28,6 +28,10 @@ OPTIONS
28--comms=:: 28--comms=::
29 Only consider symbols in these comms. CSV that understands 29 Only consider symbols in these comms. CSV that understands
30 file://filename entries. 30 file://filename entries.
31-S::
32--symbols=::
33 Only consider these symbols. CSV that understands
34 file://filename entries.
31 35
32SEE ALSO 36SEE ALSO
33-------- 37--------
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 8143477b7ef7..135b7837e6bf 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, *comm_list_str; 36static char *dso_list_str, *comm_list_str, *sym_list_str;
37static struct strlist *dso_list, *comm_list; 37static struct strlist *dso_list, *comm_list, *sym_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;
@@ -1281,6 +1281,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)
1281 if (dso_list && dso && dso->name && !strlist__has_entry(dso_list, dso->name)) 1281 if (dso_list && dso && dso->name && !strlist__has_entry(dso_list, dso->name))
1282 return 0; 1282 return 0;
1283 1283
1284 if (sym_list && sym && !strlist__has_entry(sym_list, sym->name))
1285 return 0;
1286
1284 if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) { 1287 if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) {
1285 eprintf("problem incrementing symbol count, skipping event\n"); 1288 eprintf("problem incrementing symbol count, skipping event\n");
1286 return -1; 1289 return -1;
@@ -1672,6 +1675,8 @@ static const struct option options[] = {
1672 "only consider symbols in these dsos"), 1675 "only consider symbols in these dsos"),
1673 OPT_STRING('C', "comms", &comm_list_str, "comm[,comm...]", 1676 OPT_STRING('C', "comms", &comm_list_str, "comm[,comm...]",
1674 "only consider symbols in these comms"), 1677 "only consider symbols in these comms"),
1678 OPT_STRING('S', "symbols", &sym_list_str, "symbol[,symbol...]",
1679 "only consider these symbols"),
1675 OPT_END() 1680 OPT_END()
1676}; 1681};
1677 1682
@@ -1726,6 +1731,7 @@ int cmd_report(int argc, const char **argv, const char *prefix)
1726 1731
1727 setup_list(&dso_list, dso_list_str, "dso"); 1732 setup_list(&dso_list, dso_list_str, "dso");
1728 setup_list(&comm_list, comm_list_str, "comm"); 1733 setup_list(&comm_list, comm_list_str, "comm");
1734 setup_list(&sym_list, sym_list_str, "symbol");
1729 1735
1730 setup_pager(); 1736 setup_pager();
1731 1737