Skip to contentSkip to conversation

perf: fix multi-event parsing bug

PATCH In review Stephane Eranian 1 participant 2 messages May 17, 2011 – May 18, 2011 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: fix multi-event parsing bug

This patch fixes an issue with event parsing. The following commit appears to have broken the ability to specify a comma separated list of events:

commit ceb53fbf6dbb1df26d38379a262c6981fe73dd36
Author: Ingo Molnar <[email protected]>
Date: Wed Apr 27 04:06:33 2011 +0200

perf stat: Fail more clearly when an invalid modifier is specified

This patch fixes this while preserving the desired effect:

$ perf stat -e instructions:u,instructions:k ls /dev/null
/dev/null

Performance counter stats for 'ls /dev/null':

            365956 instructions:u           #    0.00  insns per cycle        
            731806 instructions:k           #    0.00  insns per cycle        
        0.001108862  seconds time elapsed
$ perf stat -e task-clock-msecs true
invalid event modifier: '-msecs'
Run 'perf list' for a list of valid events and modifiers

---

tools/perf/util/parse-events.c +3 -0
index ffa493a..41982c3 100644
@@ -734,6 +734,9 @@ parse_event_modifier(const char **strp, struct perf_event_attr *attr)
 	if (!*str)
 		return 0;
 
+	if (*str == ',')
+		return 0;
+
 	if (*str++ != ':')
 		return -1;
 
#1 lore raw

[tip:perf/core] perf: Fix multi-event parsing bug

Commit-ID:  94692349c4fc1bc74c19a28f9379509361a06a3b
Gitweb:     http://git.kernel.org/tip/94692349c4fc1bc74c19a28f9379509361a06a3b
Author:     Stephane Eranian <[email protected]>
AuthorDate: Tue, 17 May 2011 15:36:19 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 17 May 2011 20:45:36 +0200

perf: Fix multi-event parsing bug

This patch fixes an issue with event parsing. The following commit appears to have broken the ability to specify a comma separated list of events:

commit ceb53fbf6dbb1df26d38379a262c6981fe73dd36
Author: Ingo Molnar <[email protected]>
Date: Wed Apr 27 04:06:33 2011 +0200

perf stat: Fail more clearly when an invalid modifier is specified

This patch fixes this while preserving the desired effect:

$ perf stat -e instructions:u,instructions:k ls /dev/null /dev/null

Performance counter stats for 'ls /dev/null':

            365956 instructions:u           #    0.00  insns per cycle
            731806 instructions:k           #    0.00  insns per cycle
        0.001108862  seconds time elapsed
$ perf stat -e task-clock-msecs true
invalid event modifier: '-msecs'
Run 'perf list' for a list of valid events and modifiers
---
 tools/perf/util/parse-events.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
tools/perf/util/parse-events.c +3 -0
index ffa493a..41982c3 100644
@@ -734,6 +734,9 @@ parse_event_modifier(const char **strp, struct perf_event_attr *attr)
 	if (!*str)
 		return 0;
 
+	if (*str == ',')
+		return 0;
+
 	if (*str++ != ':')
 		return -1;