[PATCH] perf, tools: Handle completion of upper case events

From: Andi Kleen
Date: Wed Oct 05 2016 - 18:20:06 EST


From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

Vendor events are often specified in upper case. perf list outputs them
in lower case. Handle this case in perf-completion.sh so that
completion on the upper case events still works.

v2: Use locale aware check for upper case
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
tools/perf/perf-completion.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 3ba80b2359cc..3cb5a800b646 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -161,7 +161,11 @@ __perf_main ()
# List possible events for -e option
elif [[ $prev == @("-e"|"--event") &&
$prev_skip_opts == @(record|stat|top) ]]; then
- evts=$($cmd list --raw-dump)
+ # handle upper case events
+ case "$cur" in
+ [[:upper:]]*) evts=$($cmd list --raw-dump | tr a-z A-Z) ;;
+ *) evts=$($cmd list --raw-dump) ;;
+ esac
__perfcomp_colon "$evts" "$cur"
else
# List subcommands for perf commands
--
2.5.5