summaryrefslogtreecommitdiffstats
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.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 4642d38b8d1..0af598a1059 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -79,7 +79,7 @@ static void write_output(struct perf_record *rec, void *buf, size_t size)
static int process_synthesized_event(struct perf_event_ops *ops,
union perf_event *event,
struct perf_sample *sample __used,
- struct perf_session *self __used)
+ struct machine *machine __used)
{
struct perf_record *rec = container_of(ops, struct perf_record, ops);
write_output(rec, event, event->header.size);
@@ -320,8 +320,6 @@ static void perf_event__synthesize_guest_os(struct machine *machine, void *data)
{
int err;
struct perf_event_ops *ops = data;
- struct perf_record *rec = container_of(ops, struct perf_record, ops);
- struct perf_session *psession = rec->session;
if (machine__is_host(machine))
return;
@@ -335,7 +333,7 @@ static void perf_event__synthesize_guest_os(struct machine *machine, void *data)
*in module instead of in guest kernel.
*/
err = perf_event__synthesize_modules(ops, process_synthesized_event,
- psession, machine);
+ machine);
if (err < 0)
pr_err("Couldn't record guest kernel [%d]'s reference"
" relocation symbol.\n", machine->pid);
@@ -345,11 +343,10 @@ static void perf_event__synthesize_guest_os(struct machine *machine, void *data)
* have no _text sometimes.
*/
err = perf_event__synthesize_kernel_mmap(ops, process_synthesized_event,
- psession, machine, "_text");
+ machine, "_text");
if (err < 0)
err = perf_event__synthesize_kernel_mmap(ops, process_synthesized_event,
- psession, machine,
- "_stext");
+ machine, "_stext");
if (err < 0)
pr_err("Couldn't record guest kernel [%d]'s reference"
" relocation symbol.\n", machine->pid);
@@ -497,6 +494,12 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
rec->post_processing_offset = lseek(output, 0, SEEK_CUR);
+ machine = perf_session__find_host_machine(session);
+ if (!machine) {
+ pr_err("Couldn't find native kernel information.\n");
+ return -1;
+ }
+
if (opts->pipe_output) {
err = perf_event__synthesize_attrs(ops, session,
process_synthesized_event);
@@ -506,7 +509,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
}
err = perf_event__synthesize_event_types(ops, process_synthesized_event,
- session);
+ machine);
if (err < 0) {
pr_err("Couldn't synthesize event_types.\n");
return err;
@@ -522,8 +525,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
* propagate errors that now are calling die()
*/
err = perf_event__synthesize_tracing_data(ops, output, evsel_list,
- process_synthesized_event,
- session);
+ process_synthesized_event);
if (err <= 0) {
pr_err("Couldn't record tracing data.\n");
return err;
@@ -532,24 +534,18 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
}
}
- machine = perf_session__find_host_machine(session);
- if (!machine) {
- pr_err("Couldn't find native kernel information.\n");
- return -1;
- }
-
err = perf_event__synthesize_kernel_mmap(ops, process_synthesized_event,
- session, machine, "_text");
+ machine, "_text");
if (err < 0)
err = perf_event__synthesize_kernel_mmap(ops, process_synthesized_event,
- session, machine, "_stext");
+ machine, "_stext");
if (err < 0)
pr_err("Couldn't record kernel reference relocation symbol\n"
"Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
"Check /proc/kallsyms permission or run as root.\n");
err = perf_event__synthesize_modules(ops, process_synthesized_event,
- session, machine);
+ machine);
if (err < 0)
pr_err("Couldn't record kernel module information.\n"
"Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
@@ -562,10 +558,10 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
if (!opts->system_wide)
perf_event__synthesize_thread_map(ops, evsel_list->threads,
process_synthesized_event,
- session);
+ machine);
else
perf_event__synthesize_threads(ops, process_synthesized_event,
- session);
+ machine);
if (rec->realtime_prio) {
struct sched_param param;