aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2013-11-06 13:41:34 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-11-07 08:42:26 -0500
commit57706abc19afc60f0b629af839d2ebee17739f59 (patch)
treeb5595bc9c69693ae0e32a88feaf97ebc27c2dd77 /tools/perf/builtin-record.c
parent77170988ff67fb959602ab4df296ae676f556a59 (diff)
perf record: Refactor feature handling into a separate function
Code move only. No logic changes. Signed-off-by: David Ahern <dsahern@gmail.com> Acked-by: Ingo Molnar <mingo@kernel.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1383763297-27066-2-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c33
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
345static 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
345static int __cmd_record(struct perf_record *rec, int argc, const char **argv) 364static 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,