perf tools: Support user regs and stack in sample parsing
Adding following info to be parsed out of the event sample: - user register set - user stack dump Both are global and specific to all events within the session. This info will be used in the unwind patches coming in shortly. Adding simple output printout (report -D) for both register and stack dumps. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Original-patch-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: "Frank Ch. Eigler" <fche@redhat.com> Cc: Arun Sharma <asharma@fb.com> Cc: Benjamin Redelings <benjamin.redelings@nescent.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Frank Ch. Eigler <fche@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Robert Richter <robert.richter@amd.com> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Ulrich Drepper <drepper@gmail.com> Link: http://lkml.kernel.org/r/1344345647-11536-11-git-send-email-jolsa@redhat.com [ Use evsel->attr.sample_regs_user ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
6a40cd90f5
commit
0f6a30150c
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <byteswap.h>
|
||||
#include <linux/bitops.h>
|
||||
#include "asm/bug.h"
|
||||
#include "evsel.h"
|
||||
#include "evlist.h"
|
||||
@@ -733,6 +734,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
|
||||
struct perf_sample *data, bool swapped)
|
||||
{
|
||||
u64 type = evsel->attr.sample_type;
|
||||
u64 regs_user = evsel->attr.sample_regs_user;
|
||||
const u64 *array;
|
||||
|
||||
/*
|
||||
@@ -869,6 +871,32 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
|
||||
sz /= sizeof(u64);
|
||||
array += sz;
|
||||
}
|
||||
|
||||
if (type & PERF_SAMPLE_REGS_USER) {
|
||||
/* First u64 tells us if we have any regs in sample. */
|
||||
u64 avail = *array++;
|
||||
|
||||
if (avail) {
|
||||
data->user_regs.regs = (u64 *)array;
|
||||
array += hweight_long(regs_user);
|
||||
}
|
||||
}
|
||||
|
||||
if (type & PERF_SAMPLE_STACK_USER) {
|
||||
u64 size = *array++;
|
||||
|
||||
data->user_stack.offset = ((char *)(array - 1)
|
||||
- (char *) event);
|
||||
|
||||
if (!size) {
|
||||
data->user_stack.size = 0;
|
||||
} else {
|
||||
data->user_stack.data = (char *)array;
|
||||
array += size / sizeof(*array);
|
||||
data->user_stack.size = *array;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user