[PATCH 3/4] perf tools: Add support of user space symbols for guest in perf kvm top.

From: Dongsheng Yang
Date: Thu Dec 19 2013 - 04:58:18 EST


# perf kvm --guestmount /tmp/guestmount/ top
Samples: 1K of event 'cycles', Event count (approx.): 259112905
17.34% libcrypto.so.1.0.1e [u] 0x000000000007d971
5.60% [guest.kernel] [g] kallsyms_expand_symbol
5.44% libcrypto.so.1.0.1e [u] md5_block_asm_data_order
4.09% [guest.kernel] [g] number.isra.1
3.59% [guest.kernel] [g] vsnprintf
3.52% sshd [u] 0x00000000000441c0
2.37% [guest.kernel] [g] format_decode
2.36% [guest.kernel] [g] memcpy
2.11% [guest.kernel] [g] strnlen

Signed-off-by: Dongsheng Yang <yangds.fnst@xxxxxxxxxxxxxx>
---
tools/perf/builtin-top.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 03d37a7..670bd0b 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -821,11 +821,9 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
break;
case PERF_RECORD_MISC_GUEST_USER:
++top->guest_us_samples;
- /*
- * TODO: we don't process guest user from host side
- * except simple counting.
- */
- /* Fall thru */
+ machine = perf_session__find_machine(session,
+ sample.pid);
+ break;
default:
goto next_event;
}
@@ -912,6 +910,7 @@ static int __cmd_top(struct perf_top *top)
struct perf_record_opts *opts = &top->record_opts;
pthread_t thread;
int ret;
+ struct rb_node *nd;

top->session = perf_session__new(NULL, false, NULL);
if (top->session == NULL)
@@ -931,6 +930,12 @@ static int __cmd_top(struct perf_top *top)

machine__synthesize_threads(&top->session->machines.host, &opts->target,
top->evlist->threads, false);
+
+ for (nd = rb_first(&top->session->machines.guests); nd; nd = rb_next(nd)) {
+ struct machine *pos = rb_entry(nd, struct machine, rb_node);
+ machine__synthesize_threads(pos, &opts->target, top->evlist->threads, false);
+ }
+
ret = perf_top__start_counters(top);
if (ret)
goto out_delete;
--
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/