aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Rogers <[email protected]>2023-09-05 11:15:54 -0700
committerArnaldo Carvalho de Melo <[email protected]>2023-09-11 10:26:36 -0300
commitfa88095856dfbad439129324a0fb6b4716e17ab1 (patch)
tree560fd601c460261dfe59870626991eb2197d6dc5
parent493902fcbdd608a6ece49c1670ffc76fed1e617f (diff)
perf shell completion: Support completion of metrics/metricgroups
Allow metrics to expand for -M or --metrics options. Committer testing: # grep -m1 'model name' /proc/cpuinfo model name : AMD Ryzen 9 5950X 16-Core Processor # Before: Just expansion of files/directories in the pwd are expanded: # . tools/perf/perf-completion.sh # perf stat -M b block/ build/ # perf stat -M b After: # . tools/perf/perf-completion.sh # perf stat -M all_l2_cache_accesses all_remote_links_outbound data_fabric l1_itlb_misses l2_cache_misses_from_l2_hwpf macro_ops_dispatched tlb all_l2_cache_hits branch_misprediction_ratio decoder l2_cache l3_cache nps1_die_to_dram all_l2_cache_misses branch_prediction ic_fetch_miss_ratio l2_cache_accesses_from_l2_hwpf l3_read_miss_latency op_cache_fetch_miss_ratio # perf stat -M branch_ branch_misprediction_ratio branch_prediction # perf stat -M branch_prediction -a sleep 1 Performance counter stats for 'system wide': 115,079,765 ex_ret_brn # 4.0 % branch_misprediction_ratio 4,561,456 ex_ret_brn_misp 1.015925106 seconds time elapsed # Suggested-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/perf-completion.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 319ad724b97a..f224d79b89e6 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -202,6 +202,10 @@ __perf_main ()
$prev_skip_opts == @(record|stat|top) ]]; then
local evts=$($cmd list --raw-dump pfm)
__perfcomp "$evts" "$cur"
+ elif [[ $prev == @("-M"|"--metrics") &&
+ $prev_skip_opts == @(stat) ]]; then
+ local metrics=$($cmd list --raw-dump metric metricgroup)
+ __perfcomp "$metrics" "$cur"
else
# List subcommands for perf commands
if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|