diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 623695e18254c4433243bc304a7e9c723e7e9cbd..db6adecf46f195f193d302f461b07a62e168d9e3 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -301,11 +301,19 @@ static void open_counters(struct perf_evlist *evlist) && attr->config == PERF_COUNT_HW_CPU_CYCLES) { if (verbose) - warning(" ... trying to fall back to cpu-clock-ticks\n"); + ui__warning("The cycles event is not supported, " + "trying to fall back to cpu-clock-ticks\n"); attr->type = PERF_TYPE_SOFTWARE; attr->config = PERF_COUNT_SW_CPU_CLOCK; goto try_again; } + + if (err == ENOENT) { + ui__warning("The %s event is not supported.\n", + event_name(pos)); + exit(EXIT_FAILURE); + } + printf("\n"); error("sys_perf_event_open() syscall returned with %d (%s). /bin/dmesg may provide additional information.\n", err, strerror(err)); diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 935fc4fd878e6515b63e545f46da922ff773a98f..fc1273e976c58f4c25d6321abf578392ba1126ad 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -870,6 +870,12 @@ static void start_counters(struct perf_evlist *evlist) goto try_again; } + if (err == ENOENT) { + ui__warning("The %s event is not supported.\n", + event_name(counter)); + goto out_err; + } + ui__warning("The sys_perf_event_open() syscall " "returned with %d (%s). /bin/dmesg " "may provide additional information.\n"