diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-12-13 12:16:30 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-01-24 14:40:08 -0500 |
commit | c0a54341c0e89333ef201fc3f3001176962f6121 (patch) | |
tree | d43d2fcb1c49ae17cbf8cf9aa270694b88cf39e1 /tools/perf/builtin-top.c | |
parent | 594ac61ad3be9c80c738a9fe3bb95c05d8d1bae1 (diff) |
perf evsel: Introduce event fallback method
The only fallback right now is for HW cpu-cycles -> SW cpu-clock, that
was done in the same way in both 'top' and 'record'.
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-58l1mgibh9oa9m0pd3fasxa5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 74fca619fc4e..8d41d0b58956 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -892,6 +892,7 @@ static void perf_top__mmap_read(struct perf_top *top) | |||
892 | 892 | ||
893 | static void perf_top__start_counters(struct perf_top *top) | 893 | static void perf_top__start_counters(struct perf_top *top) |
894 | { | 894 | { |
895 | char msg[128]; | ||
895 | struct perf_evsel *counter; | 896 | struct perf_evsel *counter; |
896 | struct perf_evlist *evlist = top->evlist; | 897 | struct perf_evlist *evlist = top->evlist; |
897 | struct perf_record_opts *opts = &top->record_opts; | 898 | struct perf_record_opts *opts = &top->record_opts; |
@@ -909,25 +910,10 @@ try_again: | |||
909 | ui__error_paranoid(); | 910 | ui__error_paranoid(); |
910 | goto out_err; | 911 | goto out_err; |
911 | } | 912 | } |
912 | /* | ||
913 | * If it's cycles then fall back to hrtimer | ||
914 | * based cpu-clock-tick sw counter, which | ||
915 | * is always available even if no PMU support: | ||
916 | */ | ||
917 | if ((err == ENOENT || err == ENXIO) && | ||
918 | (attr->type == PERF_TYPE_HARDWARE) && | ||
919 | (attr->config == PERF_COUNT_HW_CPU_CYCLES)) { | ||
920 | 913 | ||
914 | if (perf_evsel__fallback(counter, err, msg, sizeof(msg))) { | ||
921 | if (verbose) | 915 | if (verbose) |
922 | ui__warning("Cycles event not supported,\n" | 916 | ui__warning("%s\n", msg); |
923 | "trying to fall back to cpu-clock-ticks\n"); | ||
924 | |||
925 | attr->type = PERF_TYPE_SOFTWARE; | ||
926 | attr->config = PERF_COUNT_SW_CPU_CLOCK; | ||
927 | if (counter->name) { | ||
928 | free(counter->name); | ||
929 | counter->name = NULL; | ||
930 | } | ||
931 | goto try_again; | 917 | goto try_again; |
932 | } | 918 | } |
933 | 919 | ||