Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test all metrics: Fully ignore Default metric failures

Determine if a metric is default from `perf list --raw-dump $m` eg:
```
$ perf list --raw-dump l1_prefetch_miss_rate
Default4 l1_prefetch_miss_rate
```
If a metric has "not supported" or "no supported events" then ignore
these failures for default metrics. Tidy up the skip/fail messages in
the output to make them easier to spot/read.

```
$ perf list -vv "all metrics"
...
Testing llc_miss_rate
[Ignored llc_miss_rate] failed but as a Default metric this can be expected
Error: No supported events found. The LLC-loads event is not supported.
...
```

Reported-by: Thomas Richter <tmricht@linux.ibm.com>
Closes: https://lore.kernel.org/linux-perf-users/20251119104751.51960-1-tmricht@linux.ibm.com/
Reported-by: Namhyung Kim <namhyung@kernel.org>
Reported-by: James Clark <james.clark@linaro.org>
Closes: https://lore.kernel.org/lkml/aRi9xnwdLh3Dir9f@google.com/
Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
41b67ab3 d53b4996

+17 -10
+17 -10
tools/perf/tests/shell/stat_all_metrics.sh
··· 27 27 fi 28 28 if [[ "$result" =~ "Cannot resolve IDs for" || "$result" =~ "No supported events found" ]] 29 29 then 30 - if [[ "$m" == @(l1_prefetch_miss_rate|stalled_cycles_per_instruction) ]] 30 + if [[ $(perf list --raw-dump $m) == "Default"* ]] 31 31 then 32 - # Default metrics that may use unsupported events. 32 + echo "[Ignored $m] failed but as a Default metric this can be expected" 33 + echo $result 33 34 continue 34 35 fi 35 - echo "Metric contains missing events" 36 + echo "[Failed $m] Metric contains missing events" 36 37 echo $result 37 38 err=1 # Fail 38 39 continue 39 40 elif [[ "$result" =~ \ 40 41 "Access to performance monitoring and observability operations is limited" ]] 41 42 then 42 - echo "Permission failure" 43 + echo "[Skipped $m] Permission failure" 43 44 echo $result 44 45 if [[ $err -eq 0 ]] 45 46 then ··· 49 48 continue 50 49 elif [[ "$result" =~ "in per-thread mode, enable system wide" ]] 51 50 then 52 - echo "Permissions - need system wide mode" 51 + echo "[Skipped $m] Permissions - need system wide mode" 53 52 echo $result 54 53 if [[ $err -eq 0 ]] 55 54 then ··· 58 57 continue 59 58 elif [[ "$result" =~ "<not supported>" ]] 60 59 then 61 - echo "Not supported events" 60 + if [[ $(perf list --raw-dump $m) == "Default"* ]] 61 + then 62 + echo "[Ignored $m] failed but as a Default metric this can be expected" 63 + echo $result 64 + continue 65 + fi 66 + echo "[Skipped $m] Not supported events" 62 67 echo $result 63 68 if [[ $err -eq 0 ]] 64 69 then ··· 73 66 continue 74 67 elif [[ "$result" =~ "<not counted>" ]] 75 68 then 76 - echo "Not counted events" 69 + echo "[Skipped $m] Not counted events" 77 70 echo $result 78 71 if [[ $err -eq 0 ]] 79 72 then ··· 82 75 continue 83 76 elif [[ "$result" =~ "FP_ARITH" || "$result" =~ "AMX" ]] 84 77 then 85 - echo "FP issues" 78 + echo "[Skipped $m] FP issues" 86 79 echo $result 87 80 if [[ $err -eq 0 ]] 88 81 then ··· 91 84 continue 92 85 elif [[ "$result" =~ "PMM" ]] 93 86 then 94 - echo "Optane memory issues" 87 + echo "[Skipped $m] Optane memory issues" 95 88 echo $result 96 89 if [[ $err -eq 0 ]] 97 90 then ··· 108 101 # No error result and metric shown. 109 102 continue 110 103 fi 111 - echo "Metric '$m' has non-zero error '$result_err' or not printed in:" 104 + echo "[Failed $m] has non-zero error '$result_err' or not printed in:" 112 105 echo "$result" 113 106 err=1 114 107 done