This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH -tip 6/8] perf tools: Support tracepoint glob matching
- From: Masami Hiramatsu <mhiramat at redhat dot com>
- To: Ingo Molnar <mingo at elte dot hu>, lkml<linux-kernel at vger dot kernel dot org>
- Cc: Frederic Weisbecker <fweisbec at gmail dot com>, Arnaldo Carvalho de Melo <acme at redhat dot com>, systemtap<systemtap at sources dot redhat dot com>, DLE<dle-develop at lists dot sourceforge dot net>, Masami Hiramatsu <mhiramat at redhat dot com>, Ingo Molnar <mingo at elte dot hu>, Frederic Weisbecker <fweisbec at gmail dot com>, Paul Mackerras <paulus at samba dot org>, Arnaldo Carvalho de Melo <acme at redhat dot com>, Peter Zijlstra <peterz at infradead dot org>, Mike Galbraith <efault at gmx dot de>
- Date: Tue, 05 Jan 2010 17:47:17 -0500
- Subject: [PATCH -tip 6/8] perf tools: Support tracepoint glob matching
- References: <20100105224634.19431.3259.stgit@dhcp-100-2-132.bos.redhat.com>
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 flexible by using partial wildcard,
e.g. 'block:*bio*:record'.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
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>
---
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 609d5a9..05d0c5c 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,
/* sys + ':' + event + ':' + flags*/
#define MAX_EVOPT_LEN (MAX_EVENT_LENGTH * 2 + 2 + 128)
static enum event_result
-parse_subsystem_tracepoint_event(char *sys_name, char *flags)
+parse_multiple_tracepoint_event(char *sys_name, const char *evt_exp,
+ char *flags)
{
char evt_path[MAXPATHLEN];
struct dirent *evt_ent;
@@ -474,6 +475,9 @@ parse_subsystem_tracepoint_event(char *sys_name, char *flags)
|| !strcmp(evt_ent->d_name, "filter"))
continue;
+ if (!strglobmatch(evt_ent->d_name, evt_exp))
+ continue;
+
len = snprintf(event_opt, MAX_EVOPT_LEN, "%s:%s%s%s", sys_name,
evt_ent->d_name, flags ? ":" : "",
flags ?: "");
@@ -522,9 +526,10 @@ static enum event_result parse_tracepoint_event(const char **strp,
if (evt_length >= MAX_EVENT_LENGTH)
return EVT_FAILED;
- if (!strcmp(evt_name, "*")) {
+ if (strpbrk(evt_name, "*?")) {
*strp = evt_name + evt_length;
- return parse_subsystem_tracepoint_event(sys_name, flags);
+ return parse_multiple_tracepoint_event(sys_name, evt_name,
+ flags);
} else
return parse_single_tracepoint_event(sys_name, evt_name,
evt_length, flags,
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com