[tip:perf/urgent] perf tools: Make alias matching case-insensitive

From: tip-bot for Andi Kleen
Date: Tue Oct 04 2016 - 04:18:57 EST


Commit-ID: e312bcf13053970c0f07ec2c02d7d9be1a036ce0
Gitweb: http://git.kernel.org/tip/e312bcf13053970c0f07ec2c02d7d9be1a036ce0
Author: Andi Kleen <ak@xxxxxxxxxxxxxxx>
AuthorDate: Thu, 15 Sep 2016 15:24:53 -0700
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitDate: Mon, 3 Oct 2016 21:51:48 -0300

perf tools: Make alias matching case-insensitive

Make alias matching the events parser case-insensitive. This is useful
with the JSON events. perf uses lower case events, but the CPU manuals
generally use upper case event names. The JSON files use lower case by
default too. But if we search case insensitively then users can
cut-n-paste the upper case event names.

So the following works:

% perf stat -e BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL true

Performance counter stats for 'true':

305 BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL

0.000492799 seconds time elapsed

Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Acked-by: Ingo Molnar <mingo@xxxxxxxxxx>
Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Madhavan Srinivasan <maddy@xxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: linuxppc-dev@xxxxxxxxxxxxxxxx
Link: http://lkml.kernel.org/r/1473978296-20712-17-git-send-email-sukadev@xxxxxxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/parse-events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index d445b11..4e778ea 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1459,7 +1459,7 @@ comp_pmu(const void *p1, const void *p2)
struct perf_pmu_event_symbol *pmu1 = (struct perf_pmu_event_symbol *) p1;
struct perf_pmu_event_symbol *pmu2 = (struct perf_pmu_event_symbol *) p2;

- return strcmp(pmu1->symbol, pmu2->symbol);
+ return strcasecmp(pmu1->symbol, pmu2->symbol);
}

static void perf_pmu__parse_cleanup(void)