Skip to content

Commit

Permalink
perf record: Combine some auxtrace initialization into a single function
Browse files Browse the repository at this point in the history
In preparation for adding AUX area sampling support, combine some
auxtrace initialization into a single function.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1520327598-1317-2-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Mar 7, 2018
1 parent 99a3c3a commit 4b5ea3b
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,24 @@ static void record__read_auxtrace_snapshot(struct record *rec)
}
}

static int record__auxtrace_init(struct record *rec)
{
int err;

if (!rec->itr) {
rec->itr = auxtrace_record__init(rec->evlist, &err);
if (err)
return err;
}

err = auxtrace_parse_snapshot_options(rec->itr, &rec->opts,
rec->opts.auxtrace_snapshot_opts);
if (err)
return err;

return auxtrace_parse_filters(rec->evlist);
}

#else

static inline
Expand All @@ -294,6 +312,11 @@ int auxtrace_record__snapshot_start(struct auxtrace_record *itr __maybe_unused)
return 0;
}

static int record__auxtrace_init(struct record *rec __maybe_unused)
{
return 0;
}

#endif

static int record__mmap_evlist(struct record *rec,
Expand Down Expand Up @@ -1727,17 +1750,6 @@ int cmd_record(int argc, const char **argv)
alarm(rec->switch_output.time);
}

if (!rec->itr) {
rec->itr = auxtrace_record__init(rec->evlist, &err);
if (err)
goto out;
}

err = auxtrace_parse_snapshot_options(rec->itr, &rec->opts,
rec->opts.auxtrace_snapshot_opts);
if (err)
goto out;

/*
* Allow aliases to facilitate the lookup of symbols for address
* filters. Refer to auxtrace_parse_filters().
Expand All @@ -1746,7 +1758,7 @@ int cmd_record(int argc, const char **argv)

symbol__init(NULL);

err = auxtrace_parse_filters(rec->evlist);
err = record__auxtrace_init(rec);
if (err)
goto out;

Expand Down

0 comments on commit 4b5ea3b

Please sign in to comment.