Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 300289
b: refs/heads/master
c: 5622c07
h: refs/heads/master
i:
  300287: c3107a3
v: v3
  • Loading branch information
Stephane Eranian authored and Arnaldo Carvalho de Melo committed May 1, 2012
1 parent 48f1533 commit 1e06e68
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: afda0f94483f46a4caddb529b8f95e0aaf015de6
refs/heads/master: 5622c07b4741e0afd7607bce6e850b76eeb23210
33 changes: 29 additions & 4 deletions trunk/tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
{
struct perf_event_attr *attr = &evsel->attr;
struct xyarray *group_fd = NULL;
bool exclude_guest_missing = false;
int ret;

if (group && evsel != first)
group_fd = first->fd;
Expand All @@ -293,16 +295,39 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,

attr->inherit = !no_inherit;

if (system_wide)
return perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
retry:
if (exclude_guest_missing)
evsel->attr.exclude_guest = evsel->attr.exclude_host = 0;

if (system_wide) {
ret = perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
group, group_fd);
if (ret)
goto check_ret;
return 0;
}

if (!target_pid && !target_tid && (!group || evsel == first)) {
attr->disabled = 1;
attr->enable_on_exec = 1;
}

return perf_evsel__open_per_thread(evsel, evsel_list->threads,
group, group_fd);
ret = perf_evsel__open_per_thread(evsel, evsel_list->threads,
group, group_fd);
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;
}

/*
Expand Down

0 comments on commit 1e06e68

Please sign in to comment.