diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2010-01-05 17:47:17 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-13 04:09:13 -0500 |
commit | fb1d2edf7ee25a26ad0b238d0ee335a3b28b7aa3 (patch) | |
tree | eff3d2dc8fe865ecacda8733f9bf60d035626246 /tools/perf/util/parse-events.c | |
parent | 72041334b8c75ae7e1da2f17ba2b7afee8f2abd7 (diff) |
perf tools: Support tracepoint glob matching
Support glob wildcard when selecting tracepoint events by -e
option. Without this patch, perf-tools supports 'GROUP:*:record'
syntax for selecting all tracepoints under GROUP group.
With this patch, user can choose tracepoints more flexibly by using
partial wildcards, e.g. 'block:*bio*:record'.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <20100105224717.19431.68972.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 609d5a9470c5..05d0c5c2030c 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -450,7 +450,8 @@ parse_single_tracepoint_event(char *sys_name, | |||
450 | /* sys + ':' + event + ':' + flags*/ | 450 | /* sys + ':' + event + ':' + flags*/ |
451 | #define MAX_EVOPT_LEN (MAX_EVENT_LENGTH * 2 + 2 + 128) | 451 | #define MAX_EVOPT_LEN (MAX_EVENT_LENGTH * 2 + 2 + 128) |
452 | static enum event_result | 452 | static enum event_result |
453 | parse_subsystem_tracepoint_event(char *sys_name, char *flags) | 453 | parse_multiple_tracepoint_event(char *sys_name, const char *evt_exp, |
454 | char *flags) | ||
454 | { | 455 | { |
455 | char evt_path[MAXPATHLEN]; | 456 | char evt_path[MAXPATHLEN]; |
456 | struct dirent *evt_ent; | 457 | struct dirent *evt_ent; |
@@ -474,6 +475,9 @@ parse_subsystem_tracepoint_event(char *sys_name, char *flags) | |||
474 | || !strcmp(evt_ent->d_name, "filter")) | 475 | || !strcmp(evt_ent->d_name, "filter")) |
475 | continue; | 476 | continue; |
476 | 477 | ||
478 | if (!strglobmatch(evt_ent->d_name, evt_exp)) | ||
479 | continue; | ||
480 | |||
477 | len = snprintf(event_opt, MAX_EVOPT_LEN, "%s:%s%s%s", sys_name, | 481 | len = snprintf(event_opt, MAX_EVOPT_LEN, "%s:%s%s%s", sys_name, |
478 | evt_ent->d_name, flags ? ":" : "", | 482 | evt_ent->d_name, flags ? ":" : "", |
479 | flags ?: ""); | 483 | flags ?: ""); |
@@ -522,9 +526,10 @@ static enum event_result parse_tracepoint_event(const char **strp, | |||
522 | if (evt_length >= MAX_EVENT_LENGTH) | 526 | if (evt_length >= MAX_EVENT_LENGTH) |
523 | return EVT_FAILED; | 527 | return EVT_FAILED; |
524 | 528 | ||
525 | if (!strcmp(evt_name, "*")) { | 529 | if (strpbrk(evt_name, "*?")) { |
526 | *strp = evt_name + evt_length; | 530 | *strp = evt_name + evt_length; |
527 | return parse_subsystem_tracepoint_event(sys_name, flags); | 531 | return parse_multiple_tracepoint_event(sys_name, evt_name, |
532 | flags); | ||
528 | } else | 533 | } else |
529 | return parse_single_tracepoint_event(sys_name, evt_name, | 534 | return parse_single_tracepoint_event(sys_name, evt_name, |
530 | evt_length, flags, | 535 | evt_length, flags, |