Sfoglia il codice sorgente

perf record: Use sw counter only if hw pmu is not detected

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>
Robert Richter 13 anni fa
parent
commit
5a7ed29c75
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      tools/perf/builtin-record.c

+ 1 - 1
tools/perf/builtin-record.c

@@ -245,7 +245,7 @@ try_again:
 			 * based cpu-clock-tick sw counter, which
 			 * based cpu-clock-tick sw counter, which
 			 * is always available even if no PMU support:
 			 * 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) {
 					&& attr->config == PERF_COUNT_HW_CPU_CYCLES) {
 
 
 				if (verbose)
 				if (verbose)