From 10864594d8dedc63183f164c9cb139a521c7c64d Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Tue, 5 Sep 2023 11:15:52 -0700 Subject: [PATCH] perf shell completion: Restrict completion of events to events 'perf list' will list libpfm4 events and metrics which aren't valid options to the '-e' option. Restrict the events gathered so that invalid ones aren't shown. Before: $ perf stat -e Display all 633 possibilities? (y or n) After: $ perf stat -e Display all 375 possibilities? (y or n) Committer testing: # grep -m1 'model name' /proc/cpuinfo model name : AMD Ryzen 9 5950X 16-Core Processor # Before: # . tools/perf/perf-completion.sh # perf stat -e Display all 2672 possibilities? (y or n) After: # . tools/perf/perf-completion.sh # perf stat -e Display all 2648 possibilities? (y or n) Reported-by: Arnaldo Carvalho de Melo Signed-off-by: Ian Rogers Tested-by: Arnaldo Carvalho de Melo Acked-by: Namhyung Kim 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-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/perf-completion.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh index 978249d7868c2..40cfc30ad7ad8 100644 --- a/tools/perf/perf-completion.sh +++ b/tools/perf/perf-completion.sh @@ -164,7 +164,7 @@ __perf_main () $prev_skip_opts == @(record|stat|top) ]]; then local cur1=${COMP_WORDS[COMP_CWORD]} - local raw_evts=$($cmd list --raw-dump) + local raw_evts=$($cmd list --raw-dump hw sw cache tracepoint pmu sdt) local arr s tmp result cpu_evts # aarch64 doesn't have /sys/bus/event_source/devices/cpu/events -- 2.30.2