Commit 4b5ea3bd authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf record: Combine some auxtrace initialization into a single function

In preparation for adding AUX area sampling support, combine some
auxtrace initialization into a single function.
Signed-off-by: default avatarAdrian 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 99a3c3a9
...@@ -274,6 +274,24 @@ static void record__read_auxtrace_snapshot(struct record *rec) ...@@ -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 #else
static inline static inline
...@@ -294,6 +312,11 @@ int auxtrace_record__snapshot_start(struct auxtrace_record *itr __maybe_unused) ...@@ -294,6 +312,11 @@ int auxtrace_record__snapshot_start(struct auxtrace_record *itr __maybe_unused)
return 0; return 0;
} }
static int record__auxtrace_init(struct record *rec __maybe_unused)
{
return 0;
}
#endif #endif
static int record__mmap_evlist(struct record *rec, static int record__mmap_evlist(struct record *rec,
...@@ -1727,17 +1750,6 @@ int cmd_record(int argc, const char **argv) ...@@ -1727,17 +1750,6 @@ int cmd_record(int argc, const char **argv)
alarm(rec->switch_output.time); 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 * Allow aliases to facilitate the lookup of symbols for address
* filters. Refer to auxtrace_parse_filters(). * filters. Refer to auxtrace_parse_filters().
...@@ -1746,7 +1758,7 @@ int cmd_record(int argc, const char **argv) ...@@ -1746,7 +1758,7 @@ int cmd_record(int argc, const char **argv)
symbol__init(NULL); symbol__init(NULL);
err = auxtrace_parse_filters(rec->evlist); err = record__auxtrace_init(rec);
if (err) if (err)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment