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

Adrian Hunter
2020-07-09T17:37:51Z

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@intel.com>
---
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 9aa51a65593d..9c5c72094112 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2533,6 +2533,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.25.1