[PATCH V2 03/12] perf tools: Improve aux_output not supported error

From: Adrian Hunter
Date: Fri Jul 10 2020 - 11:13:09 EST


For example:
Before:
$ perf record -e '{intel_pt/branch=0/,branch-loads/aux-output/ppp}' -- ls -l
Error:
branch-loads: PMU Hardware doesn't support sampling/overflow-interrupts. Try 'perf stat'
After:
$ perf record -e '{intel_pt/branch=0/,branch-loads/aux-output/ppp}' -- ls -l
Error:
branch-loads: PMU Hardware doesn't support 'aux_output' feature

Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
---
tools/perf/util/evsel.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 80a7f9862aec..6606c1e3b4fe 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2539,6 +2539,10 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
"No such device - did you specify an out-of-range profile CPU?");
break;
case EOPNOTSUPP:
+ if (evsel->core.attr.aux_output)
+ return scnprintf(msg, size,
+ "%s: PMU Hardware doesn't support 'aux_output' feature",
+ evsel__name(evsel));
if (evsel->core.attr.sample_period != 0)
return scnprintf(msg, size,
"%s: PMU Hardware doesn't support sampling/overflow-interrupts. Try 'perf stat'",
--
2.17.1