diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-06-07 11:46:24 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-07 11:46:24 -0400 |
commit | 30c806a094493beb7691bc7957dfa02dee96230a (patch) | |
tree | 050253f0a69d5fab3cee07c07061e1468ac3c4f1 | |
parent | 3da297a60f7e8840f79f7d0b343af078890939ea (diff) |
perf_counter tools: Handle kernels with !CONFIG_PERF_COUNTER
If perf is run on a !CONFIG_PERF_COUNTER kernel right now it
bails out with no messages or with confusing messages.
Standardize this case some more and explain the situation.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/builtin-record.c | 7 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 87866294a0e6..deaee42d5eb0 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -356,9 +356,6 @@ try_again: | |||
356 | if (fd[nr_cpu][counter] < 0) { | 356 | if (fd[nr_cpu][counter] < 0) { |
357 | int err = errno; | 357 | int err = errno; |
358 | 358 | ||
359 | if (verbose) | ||
360 | error("sys_perf_counter_open() syscall returned with %d (%s)\n", | ||
361 | fd[nr_cpu][counter], strerror(err)); | ||
362 | if (err == EPERM) | 359 | if (err == EPERM) |
363 | die("Permission error - are you root?\n"); | 360 | die("Permission error - are you root?\n"); |
364 | 361 | ||
@@ -376,6 +373,10 @@ try_again: | |||
376 | attr->config = PERF_COUNT_CPU_CLOCK; | 373 | attr->config = PERF_COUNT_CPU_CLOCK; |
377 | goto try_again; | 374 | goto try_again; |
378 | } | 375 | } |
376 | printf("\n"); | ||
377 | error("perfcounter syscall returned with %d (%s)\n", | ||
378 | fd[nr_cpu][counter], strerror(err)); | ||
379 | die("No CONFIG_PERF_COUNTERS=y kernel support configured?\n"); | ||
379 | exit(-1); | 380 | exit(-1); |
380 | } | 381 | } |
381 | 382 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 1f8c97d5c32e..be1698f1189b 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -551,10 +551,6 @@ try_again: | |||
551 | if (fd[i][counter] < 0) { | 551 | if (fd[i][counter] < 0) { |
552 | int err = errno; | 552 | int err = errno; |
553 | 553 | ||
554 | if (verbose) | ||
555 | error("sys_perf_counter_open() syscall returned with %d (%s)\n", | ||
556 | fd[i][counter], strerror(err)); | ||
557 | |||
558 | if (err == EPERM) | 554 | if (err == EPERM) |
559 | die("No permission - are you root?\n"); | 555 | die("No permission - are you root?\n"); |
560 | /* | 556 | /* |
@@ -572,6 +568,10 @@ try_again: | |||
572 | attr->config = PERF_COUNT_CPU_CLOCK; | 568 | attr->config = PERF_COUNT_CPU_CLOCK; |
573 | goto try_again; | 569 | goto try_again; |
574 | } | 570 | } |
571 | printf("\n"); | ||
572 | error("perfcounter syscall returned with %d (%s)\n", | ||
573 | fd[i][counter], strerror(err)); | ||
574 | die("No CONFIG_PERF_COUNTERS=y kernel support configured?\n"); | ||
575 | exit(-1); | 575 | exit(-1); |
576 | } | 576 | } |
577 | assert(fd[i][counter] >= 0); | 577 | assert(fd[i][counter] >= 0); |