aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-06-04 07:02:07 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-06-05 08:35:19 -0400
commit41a37e20178b081193b08b228030d8f562bfee62 (patch)
tree126bc2f2f11231955fad89bf2ef6e83969b6325e /tools/perf/util/event.c
parent45d8e8025a2b2a6996be92d769fb6763bfb3cbae (diff)
perf tools: Make event__preprocess_sample parse the sample
Simplifying the tools that were using both in sequence and allowing upcoming simplifications, such as Arun's patch to sort by cpus. Cc: David S. Miller <davem@davemloft.net> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r--tools/perf/util/event.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 891753255f54..ed3e14ff6df0 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -655,11 +655,36 @@ static void dso__calc_col_width(struct dso *self)
655} 655}
656 656
657int event__preprocess_sample(const event_t *self, struct perf_session *session, 657int event__preprocess_sample(const event_t *self, struct perf_session *session,
658 struct addr_location *al, symbol_filter_t filter) 658 struct addr_location *al, struct sample_data *data,
659 symbol_filter_t filter)
659{ 660{
660 u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 661 u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
661 struct thread *thread = perf_session__findnew(session, self->ip.pid); 662 struct thread *thread;
663
664 event__parse_sample(self, session->sample_type, data);
665
666 dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld cpu:%d\n",
667 self->header.misc, data->pid, data->tid, data->ip,
668 data->period, data->cpu);
669
670 if (session->sample_type & PERF_SAMPLE_CALLCHAIN) {
671 unsigned int i;
672
673 dump_printf("... chain: nr:%Lu\n", data->callchain->nr);
662 674
675 if (!ip_callchain__valid(data->callchain, self)) {
676 pr_debug("call-chain problem with event, "
677 "skipping it.\n");
678 goto out_filtered;
679 }
680
681 if (dump_trace) {
682 for (i = 0; i < data->callchain->nr; i++)
683 dump_printf("..... %2d: %016Lx\n",
684 i, data->callchain->ips[i]);
685 }
686 }
687 thread = perf_session__findnew(session, self->ip.pid);
663 if (thread == NULL) 688 if (thread == NULL)
664 return -1; 689 return -1;
665 690
@@ -724,9 +749,9 @@ out_filtered:
724 return 0; 749 return 0;
725} 750}
726 751
727int event__parse_sample(event_t *event, u64 type, struct sample_data *data) 752int event__parse_sample(const event_t *event, u64 type, struct sample_data *data)
728{ 753{
729 u64 *array = event->sample.array; 754 const u64 *array = event->sample.array;
730 755
731 if (type & PERF_SAMPLE_IP) { 756 if (type & PERF_SAMPLE_IP) {
732 data->ip = event->ip.ip; 757 data->ip = event->ip.ip;