aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 0abfb18b911f..227b6ae99785 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -204,6 +204,9 @@ static void perf_record__open(struct perf_record *rec)
204 204
205 if (opts->group && pos != first) 205 if (opts->group && pos != first)
206 group_fd = first->fd; 206 group_fd = first->fd;
207fallback_missing_features:
208 if (opts->exclude_guest_missing)
209 attr->exclude_guest = attr->exclude_host = 0;
207retry_sample_id: 210retry_sample_id:
208 attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0; 211 attr->sample_id_all = opts->sample_id_all_avail ? 1 : 0;
209try_again: 212try_again:
@@ -217,15 +220,23 @@ try_again:
217 } else if (err == ENODEV && opts->cpu_list) { 220 } else if (err == ENODEV && opts->cpu_list) {
218 die("No such device - did you specify" 221 die("No such device - did you specify"
219 " an out-of-range profile CPU?\n"); 222 " an out-of-range profile CPU?\n");
220 } else if (err == EINVAL && opts->sample_id_all_avail) { 223 } else if (err == EINVAL) {
221 /* 224 if (!opts->exclude_guest_missing &&
222 * Old kernel, no attr->sample_id_type_all field 225 (attr->exclude_guest || attr->exclude_host)) {
223 */ 226 pr_debug("Old kernel, cannot exclude "
224 opts->sample_id_all_avail = false; 227 "guest or host samples.\n");
225 if (!opts->sample_time && !opts->raw_samples && !time_needed) 228 opts->exclude_guest_missing = true;
226 attr->sample_type &= ~PERF_SAMPLE_TIME; 229 goto fallback_missing_features;
227 230 } else if (opts->sample_id_all_avail) {
228 goto retry_sample_id; 231 /*
232 * Old kernel, no attr->sample_id_type_all field
233 */
234 opts->sample_id_all_avail = false;
235 if (!opts->sample_time && !opts->raw_samples && !time_needed)
236 attr->sample_type &= ~PERF_SAMPLE_TIME;
237
238 goto retry_sample_id;
239 }
229 } 240 }
230 241
231 /* 242 /*
@@ -503,9 +514,9 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
503 return err; 514 return err;
504 } 515 }
505 516
506 if (!!rec->no_buildid 517 if (!rec->no_buildid
507 && !perf_header__has_feat(&session->header, HEADER_BUILD_ID)) { 518 && !perf_header__has_feat(&session->header, HEADER_BUILD_ID)) {
508 pr_err("Couldn't generating buildids. " 519 pr_err("Couldn't generate buildids. "
509 "Use --no-buildid to profile anyway.\n"); 520 "Use --no-buildid to profile anyway.\n");
510 return -1; 521 return -1;
511 } 522 }