Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 288667
b: refs/heads/master
c: 0c97812
h: refs/heads/master
i:
  288665: 1b88c7f
  288663: 9880970
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Feb 14, 2012
1 parent 2e2f117 commit 7010c18
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 16 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: 7e1ccd3804281fc0755eb726b654469c40a96d89
refs/heads/master: 0c9781280fb672ca09c997df3f14ba506bbdb977
29 changes: 20 additions & 9 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ static void perf_record__open(struct perf_record *rec)

if (opts->group && pos != first)
group_fd = first->fd;
fallback_missing_features:
if (opts->exclude_guest_missing)
attr->exclude_guest = attr->exclude_host = 0;
retry_sample_id:
attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0;
try_again:
Expand All @@ -218,15 +221,23 @@ static void perf_record__open(struct perf_record *rec)
} else if (err == ENODEV && opts->cpu_list) {
die("No such device - did you specify"
" an out-of-range profile CPU?\n");
} else if (err == EINVAL && opts->sample_id_all_avail) {
/*
* Old kernel, no attr->sample_id_type_all field
*/
opts->sample_id_all_avail = false;
if (!opts->sample_time && !opts->raw_samples && !time_needed)
attr->sample_type &= ~PERF_SAMPLE_TIME;

goto retry_sample_id;
} else if (err == EINVAL) {
if (!opts->exclude_guest_missing &&
(attr->exclude_guest || attr->exclude_host)) {
pr_debug("Old kernel, cannot exclude "
"guest or host samples.\n");
opts->exclude_guest_missing = true;
goto fallback_missing_features;
} else if (opts->sample_id_all_avail) {
/*
* Old kernel, no attr->sample_id_type_all field
*/
opts->sample_id_all_avail = false;
if (!opts->sample_time && !opts->raw_samples && !time_needed)
attr->sample_type &= ~PERF_SAMPLE_TIME;

goto retry_sample_id;
}
}

/*
Expand Down
23 changes: 17 additions & 6 deletions trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,9 @@ static void perf_top__start_counters(struct perf_top *top)
attr->mmap = 1;
attr->comm = 1;
attr->inherit = top->inherit;
fallback_missing_features:
if (top->exclude_guest_missing)
attr->exclude_guest = attr->exclude_host = 0;
retry_sample_id:
attr->sample_id_all = top->sample_id_all_avail ? 1 : 0;
try_again:
Expand All @@ -883,12 +886,20 @@ static void perf_top__start_counters(struct perf_top *top)
if (err == EPERM || err == EACCES) {
ui__error_paranoid();
goto out_err;
} else if (err == EINVAL && top->sample_id_all_avail) {
/*
* Old kernel, no attr->sample_id_type_all field
*/
top->sample_id_all_avail = false;
goto retry_sample_id;
} else if (err == EINVAL) {
if (!top->exclude_guest_missing &&
(attr->exclude_guest || attr->exclude_host)) {
pr_debug("Old kernel, cannot exclude "
"guest or host samples.\n");
top->exclude_guest_missing = true;
goto fallback_missing_features;
} else if (top->sample_id_all_avail) {
/*
* Old kernel, no attr->sample_id_type_all field
*/
top->sample_id_all_avail = false;
goto retry_sample_id;
}
}
/*
* If it's cycles then fall back to hrtimer
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/perf.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ struct perf_record_opts {
bool sample_address;
bool sample_time;
bool sample_id_all_avail;
bool exclude_guest_missing;
bool system_wide;
bool period;
unsigned int freq;
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/util/top.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct perf_top {
bool inherit;
bool group;
bool sample_id_all_avail;
bool exclude_guest_missing;
bool dump_symtab;
const char *cpu_list;
struct hist_entry *sym_filter_entry;
Expand Down

0 comments on commit 7010c18

Please sign in to comment.