diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2011-01-20 23:15:45 +0900 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-28 09:20:25 -0200 |
commit | 3c42258c9a4db70133fa6946a275b62a16792bb5 (patch) | |
tree | f80956618d48e27bd08f4dacf70866bce8f6846f /tools/perf/util | |
parent | bd09d7b5efeb13965b6725b4a3e9944908bca9d2 (diff) | |
download | blackbird-op-linux-3c42258c9a4db70133fa6946a275b62a16792bb5.tar.gz blackbird-op-linux-3c42258c9a4db70133fa6946a275b62a16792bb5.zip |
perf probe: Add filters support for available functions
Add filters support for available function list.
Default filter is "!_*" for filtering out local-purpose symbols.
e.g.:
# perf probe --filter="add*" -F
add_disk
add_disk_randomness
add_input_randomness
add_interrupt_randomness
add_memory
add_page_to_unevictable_list
add_page_wait_queue
...
Cc: 2nddept-manager@sdl.hitachi.co.jp
Cc: Chase Douglas <chase.douglas@canonical.com>
Cc: Franck Bui-Huu <fbuihuu@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <20110120141545.25915.85930.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/probe-event.c | 23 | ||||
-rw-r--r-- | tools/perf/util/probe-event.h | 2 |
2 files changed, 14 insertions, 11 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 077e0518f0f7..9d237e3cff5d 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1951,21 +1951,23 @@ int del_perf_probe_events(struct strlist *dellist) return ret; } +/* TODO: don't use a global variable for filter ... */ +static struct strfilter *available_func_filter; /* - * If a symbol corresponds to a function with global binding return 0. - * For all others return 1. + * If a symbol corresponds to a function with global binding and + * matches filter return 0. For all others return 1. */ -static int filter_non_global_functions(struct map *map __unused, - struct symbol *sym) +static int filter_available_functions(struct map *map __unused, + struct symbol *sym) { - if (sym->binding != STB_GLOBAL) - return 1; - - return 0; + if (sym->binding == STB_GLOBAL && + strfilter__compare(available_func_filter, sym->name)) + return 0; + return 1; } -int show_available_funcs(const char *module) +int show_available_funcs(const char *module, struct strfilter *_filter) { struct map *map; int ret; @@ -1981,7 +1983,8 @@ int show_available_funcs(const char *module) pr_err("Failed to find %s map.\n", (module) ? : "kernel"); return -EINVAL; } - if (map__load(map, filter_non_global_functions)) { + available_func_filter = _filter; + if (map__load(map, filter_available_functions)) { pr_err("Failed to load map.\n"); return -EINVAL; } diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h index 4e80b2bbc516..3434fc9d79d5 100644 --- a/tools/perf/util/probe-event.h +++ b/tools/perf/util/probe-event.h @@ -128,7 +128,7 @@ extern int show_line_range(struct line_range *lr, const char *module); extern int show_available_vars(struct perf_probe_event *pevs, int npevs, int max_probe_points, const char *module, struct strfilter *filter, bool externs); -extern int show_available_funcs(const char *module); +extern int show_available_funcs(const char *module, struct strfilter *filter); /* Maximum index number of event-name postfix */ |