Skip to contentSkip to conversation

perf tool: Auto-complete for the event with ':'

PATCH Applied Jin Yao 3 participants 3 messages Dec 22, 2017 – Dec 28, 2017 perf events

lore
Share & tools
lore

Jin Yao

author
#0 lore raw

PATCH 1/1 perf tool: Auto-complete for the event with ':'

It's a follow up patch for a previous patch "perf tool: Return all events as auto-completions after comma".

Sorry about that, I should send these 2 patches in a patch-set.

With this patch, the auto-completion can work well for the event with ':'. For example,

root@skl:/tmp# perf stat -e block:block_ <TAB>
block:block_bio_backmerge   block:block_rq_complete
block:block_bio_bounce      block:block_rq_insert
block:block_bio_complete    block:block_rq_issue
block:block_bio_frontmerge  block:block_rq_remap
block:block_bio_queue       block:block_rq_requeue
block:block_bio_remap       block:block_sleeprq
block:block_dirty_buffer    block:block_split
block:block_getrq           block:block_touch_buffer
block:block_plug            block:block_unplug
root@skl:/tmp# perf stat -e block:block_rq_ <TAB>
block:block_rq_complete  block:block_rq_issue     block:block_rq_requeue
block:block_rq_insert    block:block_rq_remap
root@skl:/tmp# perf stat -e block:block_rq_complete <TAB>
block:block_rq_complete
root@skl:/tmp# perf stat -e block:block_rq_complete
---
 tools/perf/perf-completion.sh | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/perf-completion.sh +5 -0
index 9020641..fdf75d4 100644
@@ -280,6 +280,11 @@ _perf()
 		export COMP_WORDBREAKS
 	fi
 
+	if [[ "$COMP_WORDBREAKS" == *:* ]]; then
+		COMP_WORDBREAKS="${COMP_WORDBREAKS/:/}"
+		export COMP_WORDBREAKS
+	fi
+
 	local cur words cword prev
 	if [ $preload_get_comp_words_by_ref = "true" ]; then
 		_get_comp_words_by_ref -n =:, cur words cword prev
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw

Em Sat, Dec 23, 2017 at 04:15:58AM +0800, Jin Yao escreveu:

Quoted 7 lines

It's a follow up patch for a previous patch "perf tool: Return all events as auto-completions after comma".

Sorry about that, I should send these 2 patches in a patch-set.

With this patch, the auto-completion can work well for the event with ':'. For example,

Thanks, applied.

At first I thought it wasn't working, but that was due to me testing it as !root :-)

- Arnaldo

#2 lore raw

[tip:perf/core] perf tools: Auto-complete for events with ':'

In reply to Jin Yao
perf tools: Auto-complete for events with ':'
Commit-ID:  5d4fd9c8b83b36d34521b3af361a5726899045bf
Gitweb:     https://git.kernel.org/tip/5d4fd9c8b83b36d34521b3af361a5726899045bf
Author:     Jin Yao <[email protected]>
AuthorDate: Sat, 23 Dec 2017 04:15:58 +0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 27 Dec 2017 12:16:00 -0300

perf tools: Auto-complete for events with ':'

It's a follow up patch for a previous patch "perf tool: Return all events as auto-completions after comma".

With this patch, auto-completion can work well for events with a ':'. For example:

  root@skl:/tmp# perf stat -e block:block_<TAB>
  block:block_bio_backmerge   block:block_rq_complete
  block:block_bio_bounce      block:block_rq_insert
  block:block_bio_complete    block:block_rq_issue
  block:block_bio_frontmerge  block:block_rq_remap
  block:block_bio_queue       block:block_rq_requeue
  block:block_bio_remap       block:block_sleeprq
  block:block_dirty_buffer    block:block_split
  block:block_getrq           block:block_touch_buffer
  block:block_plug            block:block_unplug
  root@skl:/tmp# perf stat -e block:block_rq_<TAB>
  block:block_rq_complete  block:block_rq_issue     block:block_rq_requeue
  block:block_rq_insert    block:block_rq_remap
  root@skl:/tmp# perf stat -e block:block_rq_complete<TAB>
  block:block_rq_complete
  root@skl:/tmp# perf stat -e block:block_rq_complete
---
 tools/perf/perf-completion.sh | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/perf-completion.sh +5 -0
index 9020641..fdf75d4 100644
@@ -280,6 +280,11 @@ _perf()
 		export COMP_WORDBREAKS
 	fi
 
+	if [[ "$COMP_WORDBREAKS" == *:* ]]; then
+		COMP_WORDBREAKS="${COMP_WORDBREAKS/:/}"
+		export COMP_WORDBREAKS
+	fi
+
 	local cur words cword prev
 	if [ $preload_get_comp_words_by_ref = "true" ]; then
 		_get_comp_words_by_ref -n =:, cur words cword prev