• Ian Rogers's avatar
    perf shell completion: Support completion of metrics/metricgroups · fa880958
    Ian Rogers authored
    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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: default avatarIan Rogers <irogers@google.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Link: https://lore.kernel.org/r/20230905181554.3202873-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    fa880958
perf-completion.sh 6.64 KB