mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-30 13:38:40 +00:00
a3277d2d5a
Add basic bash completion for the -e option in record, top and stat subcommands. Only hardware, software and tracepoint events are supported. Breakpoints, raw events and events grouping completion need more thinking. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1344522713-27951-3-git-send-email-fweisbec@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
27 lines
542 B
Bash
27 lines
542 B
Bash
# perf completion
|
|
|
|
have perf &&
|
|
_perf()
|
|
{
|
|
local cur cmd
|
|
|
|
COMPREPLY=()
|
|
_get_comp_words_by_ref cur prev
|
|
|
|
cmd=${COMP_WORDS[0]}
|
|
|
|
# List perf subcommands
|
|
if [ $COMP_CWORD -eq 1 ]; then
|
|
cmds=$($cmd --list-cmds)
|
|
COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
|
|
# List possible events for -e option
|
|
elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then
|
|
cmds=$($cmd list --raw-dump)
|
|
COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
|
|
# Fall down to list regular files
|
|
else
|
|
_filedir
|
|
fi
|
|
} &&
|
|
complete -F _perf perf
|