From 493902fcbdd608a6ece49c1670ffc76fed1e617f Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Tue, 5 Sep 2023 11:15:53 -0700 Subject: perf completion: Support completion of libpfm4 events Use `perf list --raw-dump pfm` to support completion of libpfm4 events. Committer testing: # grep -m1 'model name' /proc/cpuinfo model name : AMD Ryzen 9 5950X 16-Core Processor Before: Files in the current directory are expanded when After: Only the PFM events are: # . tools/perf/perf-completion.sh # perf stat --pfm-events Becomes: # perf stat --pfm-events perf_raw::r0000 As apparently there are no other PFM events for this Ryzen 9 5950X machine. Signed-off-by: Ian Rogers Acked-by: Namhyung Kim Tested-by: Arnaldo Carvalho de Melo Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mark Rutland Cc: Peter Zijlstra Cc: Stephane Eranian Link: https://lore.kernel.org/r/20230905181554.3202873-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/perf-completion.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/perf/perf-completion.sh') diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh index 40cfc30ad7ad..319ad724b97a 100644 --- a/tools/perf/perf-completion.sh +++ b/tools/perf/perf-completion.sh @@ -198,6 +198,10 @@ __perf_main () else __perfcomp_colon "$evts" "$cur1" fi + elif [[ $prev == @("--pfm-events") && + $prev_skip_opts == @(record|stat|top) ]]; then + local evts=$($cmd list --raw-dump pfm) + __perfcomp "$evts" "$cur" else # List subcommands for perf commands if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched| -- cgit v1.2.3