Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1503440

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

From Andi Kleen <andi@firstfloor.org>
Newsgroups linux.kernel
Subject [PATCH 2/3] perf, tools: Handle completion of upper case events
Date 2016-10-19 01:30 +0200
Message-ID <stLZw-Db-19@gated-at.bofh.it> (permalink)
References <stLZv-Db-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Andi Kleen <ak@linux.intel.com>

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
v3: Use perf list json
v4: Use perf list vendor
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 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..72391ff68f66 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 vendor | tr a-z A-Z) ;;
+			*) evts=$($cmd list --raw-dump) ;;
+		esac
 		__perfcomp_colon "$evts" "$cur"
 	else
 		# List subcommands for perf commands
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] perf, tools: Add support for perf list vendor Andi Kleen <andi@firstfloor.org> - 2016-10-19 01:30 +0200
  [PATCH 2/3] perf, tools: Handle completion of upper case events Andi Kleen <andi@firstfloor.org> - 2016-10-19 01:30 +0200
  [PATCH 3/3] perf, tools: Fix completion script to handle comma list Andi Kleen <andi@firstfloor.org> - 2016-10-19 01:30 +0200

csiph-web