From: Song Liu <songliubraving@fb.com>
To: <netdev@vger.kernel.org>, <bpf@vger.kernel.org>
Cc: <quentin@isovalent.com>, <kernel-team@fb.com>, <ast@kernel.org>,
<daniel@iogearbox.net>, <arnaldo.melo@gmail.com>,
<jolsa@kernel.org>, Song Liu <songliubraving@fb.com>
Subject: [PATCH v3 bpf-next 3/3] bpftool: bash completion for "bpftool prog profile"
Date: Tue, 3 Mar 2020 11:55:55 -0800 [thread overview]
Message-ID: <20200303195555.1309028-4-songliubraving@fb.com> (raw)
In-Reply-To: <20200303195555.1309028-1-songliubraving@fb.com>
Add bash completion for "bpftool prog profile" command.
Signed-off-by: Song Liu <songliubraving@fb.com>
---
tools/bpf/bpftool/bash-completion/bpftool | 45 ++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
index f2838a658339..e54f36c0c973 100644
--- a/tools/bpf/bpftool/bash-completion/bpftool
+++ b/tools/bpf/bpftool/bash-completion/bpftool
@@ -337,6 +337,7 @@ _bpftool()
local PROG_TYPE='id pinned tag name'
local MAP_TYPE='id pinned name'
+ local METRIC_TYPE='cycles instructions l1d_loads llc_misses'
case $command in
show|list)
[[ $prev != "$command" ]] && return 0
@@ -498,6 +499,48 @@ _bpftool()
tracelog)
return 0
;;
+ profile)
+ case $cword in
+ 3)
+ COMPREPLY=( $( compgen -W "$PROG_TYPE" -- "$cur" ) )
+ return 0
+ ;;
+ 4)
+ case $prev in
+ id)
+ _bpftool_get_prog_ids
+ ;;
+ name)
+ _bpftool_get_map_names
+ ;;
+ pinned)
+ _filedir
+ ;;
+ esac
+ return 0
+ ;;
+ 5)
+ COMPREPLY=( $( compgen -W "$METRIC_TYPE duration" -- "$cur" ) )
+ return 0
+ ;;
+ 6)
+ case $prev in
+ duration)
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W "$METRIC_TYPE" -- "$cur" ) )
+ return 0
+ ;;
+ esac
+ return 0
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W "$METRIC_TYPE" -- "$cur" ) )
+ return 0
+ ;;
+ esac
+ ;;
run)
if [[ ${#words[@]} -lt 5 ]]; then
_filedir
@@ -525,7 +568,7 @@ _bpftool()
*)
[[ $prev == $object ]] && \
COMPREPLY=( $( compgen -W 'dump help pin attach detach \
- load loadall show list tracelog run' -- "$cur" ) )
+ load loadall show list tracelog run profile' -- "$cur" ) )
;;
esac
;;
--
2.17.1
next prev parent reply other threads:[~2020-03-03 19:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 19:55 [PATCH v3 bpf-next 0/3] bpftool: introduce prog profile Song Liu
2020-03-03 19:55 ` [PATCH v3 bpf-next 1/3] bpftool: introduce "prog profile" command Song Liu
2020-03-04 10:59 ` Quentin Monnet
2020-03-03 19:55 ` [PATCH v3 bpf-next 2/3] bpftool: Documentation for bpftool prog profile Song Liu
2020-03-04 11:01 ` Quentin Monnet
2020-03-03 19:55 ` Song Liu [this message]
2020-03-04 10:59 ` [PATCH v3 bpf-next 3/3] bpftool: bash completion for "bpftool prog profile" Quentin Monnet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200303195555.1309028-4-songliubraving@fb.com \
--to=songliubraving@fb.com \
--cc=arnaldo.melo@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jolsa@kernel.org \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=quentin@isovalent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).