perf record, x86: Print more intelligent error message when sampling fails
authorSimon Kaempflein <s.kaempflein@gmx.de>
Mon, 16 Nov 2009 05:25:53 +0000 (15:25 +1000)
committerIngo Molnar <mingo@elte.hu>
Mon, 23 Nov 2009 08:40:13 +0000 (09:40 +0100)
Print more accurate error message when "perf record" fails because
there is no APIC support, on x86.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/builtin-record.c

index 87f98fd..0e519c6 100644 (file)
@@ -307,6 +307,12 @@ try_again:
                printf("\n");
                error("perfcounter syscall returned with %d (%s)\n",
                        fd[nr_cpu][counter], strerror(err));
+
+#if defined(__i386__) || defined(__x86_64__)
+               if (attr->type == PERF_TYPE_HARDWARE && err == EOPNOTSUPP)
+                       die("No hardware sampling interrupt available. No APIC? If so then you can boot the kernel with the \"lapic\" boot parameter to force-enable it.\n");
+#endif
+
                die("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
                exit(-1);
        }