diff options
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index ea4c04f7437e..2932069ad7a8 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -342,9 +342,28 @@ out: | |||
342 | return rc; | 342 | return rc; |
343 | } | 343 | } |
344 | 344 | ||
345 | static void perf_record__init_features(struct perf_record *rec) | ||
346 | { | ||
347 | struct perf_evlist *evsel_list = rec->evlist; | ||
348 | struct perf_session *session = rec->session; | ||
349 | int feat; | ||
350 | |||
351 | for (feat = HEADER_FIRST_FEATURE; feat < HEADER_LAST_FEATURE; feat++) | ||
352 | perf_header__set_feat(&session->header, feat); | ||
353 | |||
354 | if (rec->no_buildid) | ||
355 | perf_header__clear_feat(&session->header, HEADER_BUILD_ID); | ||
356 | |||
357 | if (!have_tracepoints(&evsel_list->entries)) | ||
358 | perf_header__clear_feat(&session->header, HEADER_TRACING_DATA); | ||
359 | |||
360 | if (!rec->opts.branch_stack) | ||
361 | perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK); | ||
362 | } | ||
363 | |||
345 | static int __cmd_record(struct perf_record *rec, int argc, const char **argv) | 364 | static int __cmd_record(struct perf_record *rec, int argc, const char **argv) |
346 | { | 365 | { |
347 | int err, feat; | 366 | int err; |
348 | unsigned long waking = 0; | 367 | unsigned long waking = 0; |
349 | const bool forks = argc > 0; | 368 | const bool forks = argc > 0; |
350 | struct machine *machine; | 369 | struct machine *machine; |
@@ -371,17 +390,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv) | |||
371 | 390 | ||
372 | rec->session = session; | 391 | rec->session = session; |
373 | 392 | ||
374 | for (feat = HEADER_FIRST_FEATURE; feat < HEADER_LAST_FEATURE; feat++) | 393 | perf_record__init_features(rec); |
375 | perf_header__set_feat(&session->header, feat); | ||
376 | |||
377 | if (rec->no_buildid) | ||
378 | perf_header__clear_feat(&session->header, HEADER_BUILD_ID); | ||
379 | |||
380 | if (!have_tracepoints(&evsel_list->entries)) | ||
381 | perf_header__clear_feat(&session->header, HEADER_TRACING_DATA); | ||
382 | |||
383 | if (!rec->opts.branch_stack) | ||
384 | perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK); | ||
385 | 394 | ||
386 | if (forks) { | 395 | if (forks) { |
387 | err = perf_evlist__prepare_workload(evsel_list, &opts->target, | 396 | err = perf_evlist__prepare_workload(evsel_list, &opts->target, |