Skip to contentSkip to conversation

perf tools: Accept case-insensitive symbolic event variants

tip:perf/stat tip-bot for Ingo Molnar 1 participant 1 message Apr 27, 2011 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  b908debd4eef91471016138569f7a9e292be682e
Gitweb:     http://git.kernel.org/tip/b908debd4eef91471016138569f7a9e292be682e
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 27 Apr 2011 03:55:40 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 26 Apr 2011 20:04:55 +0200

perf tools: Accept case-insensitive symbolic event variants

We currently fail on something like '-e CPU-migrations', with:

invalid or unsupported event: 'CPU-migrations'

While 'CPU-migrations' is how we actually print out the event in the default perf stat output:

Performance counter stats for 'true':

          0.202204 task-clock-msecs         #      0.282 CPUs
                 0 context-switches         #      0.000 M/sec
                 0 CPU-migrations           #      0.000 M/sec

So change the matching to be case-insensitive.

---
 tools/perf/util/parse-events.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
tools/perf/util/parse-events.c +5 -3
index 1869e4c..8e54bdb 100644
@@ -649,13 +649,15 @@ static int check_events(const char *str, unsigned int i)
 	int n;
 
 	n = strlen(event_symbols[i].symbol);
-	if (!strncmp(str, event_symbols[i].symbol, n))
+	if (!strncasecmp(str, event_symbols[i].symbol, n))
 		return n;
 
 	n = strlen(event_symbols[i].alias);
-	if (n)
-		if (!strncmp(str, event_symbols[i].alias, n))
+	if (n) {
+		if (!strncasecmp(str, event_symbols[i].alias, n))
 			return n;
+	}
+
 	return 0;
 }