diff options
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r-- | tools/perf/builtin-stat.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index ef067c193f93..1c2ac148a7d5 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -247,6 +247,7 @@ static int read_counter(struct perf_evsel *counter) | |||
247 | 247 | ||
248 | static int __run_perf_stat(int argc __maybe_unused, const char **argv) | 248 | static int __run_perf_stat(int argc __maybe_unused, const char **argv) |
249 | { | 249 | { |
250 | char msg[512]; | ||
250 | unsigned long long t0, t1; | 251 | unsigned long long t0, t1; |
251 | struct perf_evsel *counter; | 252 | struct perf_evsel *counter; |
252 | int status = 0; | 253 | int status = 0; |
@@ -324,20 +325,13 @@ static int __run_perf_stat(int argc __maybe_unused, const char **argv) | |||
324 | continue; | 325 | continue; |
325 | } | 326 | } |
326 | 327 | ||
327 | if (errno == EPERM || errno == EACCES) { | 328 | perf_evsel__open_strerror(counter, &target, |
328 | error("You may not have permission to collect %sstats.\n" | 329 | errno, msg, sizeof(msg)); |
329 | "\t Consider tweaking" | 330 | ui__error("%s\n", msg); |
330 | " /proc/sys/kernel/perf_event_paranoid or running as root.", | 331 | |
331 | target.system_wide ? "system-wide " : ""); | ||
332 | } else { | ||
333 | error("open_counter returned with %d (%s). " | ||
334 | "/bin/dmesg may provide additional information.\n", | ||
335 | errno, strerror(errno)); | ||
336 | } | ||
337 | if (child_pid != -1) | 332 | if (child_pid != -1) |
338 | kill(child_pid, SIGTERM); | 333 | kill(child_pid, SIGTERM); |
339 | 334 | ||
340 | pr_err("Not all events could be opened.\n"); | ||
341 | return -1; | 335 | return -1; |
342 | } | 336 | } |
343 | counter->supported = true; | 337 | counter->supported = true; |