[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-4c635a4e04700a371ef7e4d4bb33ed88747e801e@git.kernel.org>
Date: Wed, 1 Dec 2010 09:14:14 GMT
From: tip-bot for Corey Ashford <cjashfor@...ux.vnet.ibm.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, linux-kernel@...r.kernel.org, paulus@...ba.org,
julia@...u.dk, hpa@...or.com, mingo@...hat.com,
michaele@....ibm.com, a.p.zijlstra@...llo.nl, fweisbec@...il.com,
tglx@...utronix.de, cjashfor@...ux.vnet.ibm.com, mingo@...e.hu
Subject: [tip:perf/core] perf tools: fix event parsing of comma-separated tracepoint events
Commit-ID: 4c635a4e04700a371ef7e4d4bb33ed88747e801e
Gitweb: http://git.kernel.org/tip/4c635a4e04700a371ef7e4d4bb33ed88747e801e
Author: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
AuthorDate: Tue, 30 Nov 2010 14:27:01 -0800
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 30 Nov 2010 23:04:39 -0200
perf tools: fix event parsing of comma-separated tracepoint events
There are number of issues that prevent the use of multiple tracepoint events
being specified in a -e/--event switch, separated by commas.
For example, perf stat -e irq:irq_handler_entry,irq:irq_handler_exit ... fails
because the tracepoint event parsing code doesn't recognize the comma separator
properly.
This patch corrects those issues.
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Julia Lawall <julia@...u.dk>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Reported-by: Michael Ellerman <michaele@....ibm.com>
LKML-Reference: <1291156021-17711-1-git-send-email-cjashfor@...ux.vnet.ibm.com>
Signed-off-by: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/parse-events.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4af5bd5..c305305 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -434,7 +434,7 @@ parse_single_tracepoint_event(char *sys_name,
id = atoll(id_buf);
attr->config = id;
attr->type = PERF_TYPE_TRACEPOINT;
- *strp = evt_name + evt_length;
+ *strp += strlen(sys_name) + evt_length + 1; /* + 1 for the ':' */
attr->sample_type |= PERF_SAMPLE_RAW;
attr->sample_type |= PERF_SAMPLE_TIME;
@@ -495,7 +495,7 @@ static enum event_result parse_tracepoint_event(const char **strp,
struct perf_event_attr *attr)
{
const char *evt_name;
- char *flags;
+ char *flags = NULL, *comma_loc;
char sys_name[MAX_EVENT_LENGTH];
unsigned int sys_length, evt_length;
@@ -514,6 +514,11 @@ static enum event_result parse_tracepoint_event(const char **strp,
sys_name[sys_length] = '\0';
evt_name = evt_name + 1;
+ comma_loc = strchr(evt_name, ',');
+ if (comma_loc) {
+ /* take the event name up to the comma */
+ evt_name = strndup(evt_name, comma_loc - evt_name);
+ }
flags = strchr(evt_name, ':');
if (flags) {
/* split it out: */
@@ -524,9 +529,8 @@ static enum event_result parse_tracepoint_event(const char **strp,
evt_length = strlen(evt_name);
if (evt_length >= MAX_EVENT_LENGTH)
return EVT_FAILED;
-
if (strpbrk(evt_name, "*?")) {
- *strp = evt_name + evt_length;
+ *strp += strlen(sys_name) + evt_length;
return parse_multiple_tracepoint_event(sys_name, evt_name,
flags);
} else
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists