aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evsel.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-08-07 09:20:45 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-10 15:47:02 -0400
commit0f6a30150ca2e0cf4f893e7173d61434a3c02e0e (patch)
tree0e20eb1977e7c811a75e5d19d32b67fb7eb7f8f1 /tools/perf/util/evsel.c
parent6a40cd90f5deb6dec322eeb54587ae55a934db2c (diff)
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>
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r--tools/perf/util/evsel.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 2eaae140def2..a2da682db819 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <byteswap.h> 10#include <byteswap.h>
11#include <linux/bitops.h>
11#include "asm/bug.h" 12#include "asm/bug.h"
12#include "evsel.h" 13#include "evsel.h"
13#include "evlist.h" 14#include "evlist.h"
@@ -733,6 +734,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
733 struct perf_sample *data, bool swapped) 734 struct perf_sample *data, bool swapped)
734{ 735{
735 u64 type = evsel->attr.sample_type; 736 u64 type = evsel->attr.sample_type;
737 u64 regs_user = evsel->attr.sample_regs_user;
736 const u64 *array; 738 const u64 *array;
737 739
738 /* 740 /*
@@ -869,6 +871,32 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
869 sz /= sizeof(u64); 871 sz /= sizeof(u64);
870 array += sz; 872 array += sz;
871 } 873 }
874
875 if (type & PERF_SAMPLE_REGS_USER) {
876 /* First u64 tells us if we have any regs in sample. */
877 u64 avail = *array++;
878
879 if (avail) {
880 data->user_regs.regs = (u64 *)array;
881 array += hweight_long(regs_user);
882 }
883 }
884
885 if (type & PERF_SAMPLE_STACK_USER) {
886 u64 size = *array++;
887
888 data->user_stack.offset = ((char *)(array - 1)
889 - (char *) event);
890
891 if (!size) {
892 data->user_stack.size = 0;
893 } else {
894 data->user_stack.data = (char *)array;
895 array += size / sizeof(*array);
896 data->user_stack.size = *array;
897 }
898 }
899
872 return 0; 900 return 0;
873} 901}
874 902