mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 23:21:46 +00:00
perf evsel: Do missing feature fallbacks in just one place
Instead of doing it in stat, top, record or any other tool that opens event descriptors. 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-vr8hzph83d5t2mdlkf565h84@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
ce90e3856b
commit
594ac61ad3
6 changed files with 31 additions and 90 deletions
|
@ -132,8 +132,6 @@ static struct stats walltime_nsecs_stats;
|
|||
static int create_perf_stat_counter(struct perf_evsel *evsel)
|
||||
{
|
||||
struct perf_event_attr *attr = &evsel->attr;
|
||||
bool exclude_guest_missing = false;
|
||||
int ret;
|
||||
|
||||
if (scale)
|
||||
attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
|
||||
|
@ -141,16 +139,8 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
|
|||
|
||||
attr->inherit = !no_inherit;
|
||||
|
||||
retry:
|
||||
if (exclude_guest_missing)
|
||||
evsel->attr.exclude_guest = evsel->attr.exclude_host = 0;
|
||||
|
||||
if (perf_target__has_cpu(&target)) {
|
||||
ret = perf_evsel__open_per_cpu(evsel, perf_evsel__cpus(evsel));
|
||||
if (ret)
|
||||
goto check_ret;
|
||||
return 0;
|
||||
}
|
||||
if (perf_target__has_cpu(&target))
|
||||
return perf_evsel__open_per_cpu(evsel, perf_evsel__cpus(evsel));
|
||||
|
||||
if (!perf_target__has_task(&target) &&
|
||||
perf_evsel__is_group_leader(evsel)) {
|
||||
|
@ -158,21 +148,7 @@ retry:
|
|||
attr->enable_on_exec = 1;
|
||||
}
|
||||
|
||||
ret = perf_evsel__open_per_thread(evsel, evsel_list->threads);
|
||||
if (!ret)
|
||||
return 0;
|
||||
/* fall through */
|
||||
check_ret:
|
||||
if (ret && errno == EINVAL) {
|
||||
if (!exclude_guest_missing &&
|
||||
(evsel->attr.exclude_guest || evsel->attr.exclude_host)) {
|
||||
pr_debug("Old kernel, cannot exclude "
|
||||
"guest or host samples.\n");
|
||||
exclude_guest_missing = true;
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return perf_evsel__open_per_thread(evsel, evsel_list->threads);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue