Skip to content

Commit

Permalink
perf tools: Accept case-insensitive symbolic event variants
Browse files Browse the repository at this point in the history
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.

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/n/tip-omcm3edjjtx83a4kh2e244se@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Apr 26, 2011
1 parent d58f4c8 commit b908deb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tools/perf/util/parse-events.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b908deb

Please sign in to comment.