]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
perf record: Use sw counter only if hw pmu is not detected
authorRobert Richter <robert.richter@amd.com>
Thu, 5 Apr 2012 16:26:28 +0000 (18:26 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 11 Apr 2012 20:39:19 +0000 (17:39 -0300)
Use cpu-clock-tick sw counter for cpu-cycles only if there is no hw
pmu available. This is the case if the syscall reports ENOENT. In
other cases (e.g. invalid attributes) we don't want the sw counter to
be used.

Cc: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1333643188-26895-5-git-send-email-robert.richter@amd.com
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-record.c

index be4e1eee782e658f00ab06cfa679414341952086..10b1f1f25ed7c6d61db3b9ed6a356b9ecb9789f8 100644 (file)
@@ -245,7 +245,7 @@ try_again:
                         * based cpu-clock-tick sw counter, which
                         * is always available even if no PMU support:
                         */
-                       if (attr->type == PERF_TYPE_HARDWARE
+                       if (err == ENOENT && attr->type == PERF_TYPE_HARDWARE
                                        && attr->config == PERF_COUNT_HW_CPU_CYCLES) {
 
                                if (verbose)