[PATCH 4/4] perf tools: Add support of user space symbols for guest in perf kvm record.
From: Dongsheng Yang
Date: Thu Dec 19 2013 - 04:57:22 EST
# perf kvm --guestmount /tmp/guestmount/ record -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.828 MB perf.data.guest (~36163 samples) ]
# perf kvm --guestmount /tmp/guestmount/ report
Samples: 4K of event 'cycles', Event count (approx.): 2662750816
8.67% [guest/9217] dd [u] 0x0000000000004e90
6.62% [guest/9217] [guest.kernel.kallsyms.9217] [g] fget_light
6.17% [guest/9217] [guest.kernel.kallsyms.9217] [g] system_call
5.97% [guest/9217] [guest.kernel.kallsyms.9217] [g] __srcu_read_lock
5.53% [guest/9217] [guest.kernel.kallsyms.9217] [g] __srcu_read_unlock
5.47% [guest/9217] [guest.kernel.kallsyms.9217] [g] __audit_syscall_exit
5.38% [guest/9217] [guest.kernel.kallsyms.9217] [g] fsnotify
5.32% [guest/9217] [guest.kernel.kallsyms.9217] [g] system_call_after_swapgs
4.45% [guest/9217] libc-2.17.so [u] __GI___libc_write
4.15% [guest/9217] [guest.kernel.kallsyms.9217] [g] sys_write
3.97% [guest/9217] [guest.kernel.kallsyms.9217] [g] vfs_read
3.78% [guest/9217] libc-2.17.so [u] __GI___libc_read
Signed-off-by: Dongsheng Yang <yangds.fnst@xxxxxxxxxxxxxx>
---
tools/perf/builtin-record.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index c1c1200..ac1e540 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -279,6 +279,9 @@ static void perf_event__synthesize_guest_os(struct machine *machine, void *data)
{
int err;
struct perf_tool *tool = data;
+ struct perf_record *rec = container_of(tool, struct perf_record, tool);
+ struct perf_record_opts *opts = &rec->opts;
+ struct perf_evlist *evsel_list = rec->evlist;
/*
*As for guest kernel when processing subcommand record&report,
*we arrange module mmap prior to guest kernel mmap and trigger
@@ -305,6 +308,13 @@ static void perf_event__synthesize_guest_os(struct machine *machine, void *data)
if (err < 0)
pr_err("Couldn't record guest kernel [%d]'s reference"
" relocation symbol.\n", machine->pid);
+
+ err = __machine__synthesize_threads(machine, tool, &opts->target, evsel_list->threads,
+ process_synthesized_event, opts->sample_address);
+
+ if (err < 0)
+ pr_err("Couldn't record guest userspace [%d]'s reference"
+ " relocation symbol.\n", machine->pid);
}
static struct perf_event_header finished_round_event = {
--
1.8.2.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/