aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-probe.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2011-01-20 09:15:45 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-01-28 06:20:25 -0500
commit3c42258c9a4db70133fa6946a275b62a16792bb5 (patch)
treef80956618d48e27bd08f4dacf70866bce8f6846f /tools/perf/builtin-probe.c
parentbd09d7b5efeb13965b6725b4a3e9944908bca9d2 (diff)
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/builtin-probe.c')
-rw-r--r--tools/perf/builtin-probe.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index abb423e164c8..fcde0031085f 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -45,6 +45,7 @@
45#include "util/probe-event.h" 45#include "util/probe-event.h"
46 46
47#define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*" 47#define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*"
48#define DEFAULT_FUNC_FILTER "!_*"
48#define MAX_PATH_LEN 256 49#define MAX_PATH_LEN 256
49 50
50/* Session management structure */ 51/* Session management structure */
@@ -159,6 +160,7 @@ static int opt_show_vars(const struct option *opt __used,
159 160
160 return ret; 161 return ret;
161} 162}
163#endif
162 164
163static int opt_set_filter(const struct option *opt __used, 165static int opt_set_filter(const struct option *opt __used,
164 const char *str, int unset __used) 166 const char *str, int unset __used)
@@ -180,7 +182,6 @@ static int opt_set_filter(const struct option *opt __used,
180 182
181 return 0; 183 return 0;
182} 184}
183#endif
184 185
185static const char * const probe_usage[] = { 186static const char * const probe_usage[] = {
186 "perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]", 187 "perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]",
@@ -236,10 +237,6 @@ static const struct option options[] = {
236 "Show accessible variables on PROBEDEF", opt_show_vars), 237 "Show accessible variables on PROBEDEF", opt_show_vars),
237 OPT_BOOLEAN('\0', "externs", &params.show_ext_vars, 238 OPT_BOOLEAN('\0', "externs", &params.show_ext_vars,
238 "Show external variables too (with --vars only)"), 239 "Show external variables too (with --vars only)"),
239 OPT_CALLBACK('\0', "filter", NULL,
240 "[!]FILTER", "Set a variable filter (with --vars only)\n"
241 "\t\t\t(default: \"" DEFAULT_VAR_FILTER "\")",
242 opt_set_filter),
243 OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, 240 OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
244 "file", "vmlinux pathname"), 241 "file", "vmlinux pathname"),
245 OPT_STRING('s', "source", &symbol_conf.source_prefix, 242 OPT_STRING('s', "source", &symbol_conf.source_prefix,
@@ -252,6 +249,11 @@ static const struct option options[] = {
252 "Set how many probe points can be found for a probe."), 249 "Set how many probe points can be found for a probe."),
253 OPT_BOOLEAN('F', "funcs", &params.show_funcs, 250 OPT_BOOLEAN('F', "funcs", &params.show_funcs,
254 "Show potential probe-able functions."), 251 "Show potential probe-able functions."),
252 OPT_CALLBACK('\0', "filter", NULL,
253 "[!]FILTER", "Set a filter (with --vars/funcs only)\n"
254 "\t\t\t(default: \"" DEFAULT_VAR_FILTER "\" for --vars,\n"
255 "\t\t\t \"" DEFAULT_FUNC_FILTER "\" for --funcs)",
256 opt_set_filter),
255 OPT_END() 257 OPT_END()
256}; 258};
257 259
@@ -322,7 +324,12 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
322 pr_err(" Error: Don't use --funcs with --vars.\n"); 324 pr_err(" Error: Don't use --funcs with --vars.\n");
323 usage_with_options(probe_usage, options); 325 usage_with_options(probe_usage, options);
324 } 326 }
325 ret = show_available_funcs(params.target_module); 327 if (!params.filter)
328 params.filter = strfilter__new(DEFAULT_FUNC_FILTER,
329 NULL);
330 ret = show_available_funcs(params.target_module,
331 params.filter);
332 strfilter__delete(params.filter);
326 if (ret < 0) 333 if (ret < 0)
327 pr_err(" Error: Failed to show functions." 334 pr_err(" Error: Failed to show functions."
328 " (%d)\n", ret); 335 " (%d)\n", ret);