Skip to content

Commit

Permalink
perf record: Use sw counter only if hw pmu is not detected
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Robert Richter authored and Arnaldo Carvalho de Melo committed Apr 11, 2012
1 parent 61d5bf5 commit 5a7ed29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static void perf_record__open(struct perf_record *rec)
* 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)
Expand Down

0 comments on commit 5a7ed29

Please sign in to comment.