aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-04-28 02:48:42 -0400
committerIngo Molnar <mingo@elte.hu>2011-04-28 02:48:42 -0400
commitede70290046043b2638204cab55e26ea1d0c6cd9 (patch)
treeb5de51125db7477b18776614923edea00a20fc31 /tools
parentf9cef0a90c4e7637f1ec98474a1a099aec45eb65 (diff)
perf stat: Fix compatibility behavior
Instead of failing on an unknown event, when new perf stat is run on older kernels: $ ./perf stat true Error: open_counter returned with 22 (Invalid argument). /bin/dmesg may provide additional information. Fatal: Not all events could be opened. Just ignore EINVAL and ENOSYS, we'll print the results as not counted: Performance counter stats for 'true': 0.239483 task-clock # 0.493 CPUs utilized 0 context-switches # 0.000 M/sec 0 CPU-migrations # 0.000 M/sec 86 page-faults # 0.359 M/sec 704,766 cycles # 2.943 GHz <not counted> stalled-cycles 381,961 instructions # 0.54 insns per cycle 69,626 branches # 290.735 M/sec 4,594 branch-misses # 6.60% of all branches 0.000485883 seconds time elapsed Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Link: http://lkml.kernel.org/n/tip-7y40wib8n1eqio5hjpn3dsrm@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-stat.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 5658a770dbd7..da77077450cf 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -372,7 +372,10 @@ static int run_perf_stat(int argc __used, const char **argv)
372 372
373 list_for_each_entry(counter, &evsel_list->entries, node) { 373 list_for_each_entry(counter, &evsel_list->entries, node) {
374 if (create_perf_stat_counter(counter) < 0) { 374 if (create_perf_stat_counter(counter) < 0) {
375 if (errno == -EPERM || errno == -EACCES) { 375 if (errno == EINVAL || errno == ENOSYS)
376 continue;
377
378 if (errno == EPERM || errno == EACCES) {
376 error("You may not have permission to collect %sstats.\n" 379 error("You may not have permission to collect %sstats.\n"
377 "\t Consider tweaking" 380 "\t Consider tweaking"
378 " /proc/sys/kernel/perf_event_paranoid or running as root.", 381 " /proc/sys/kernel/perf_event_paranoid or running as root.",