aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r--tools/perf/util/event.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 2fbf6a463c81..d7f21d71eb69 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -657,11 +657,36 @@ static void dso__calc_col_width(struct dso *self)
657} 657}
658 658
659int event__preprocess_sample(const event_t *self, struct perf_session *session, 659int event__preprocess_sample(const event_t *self, struct perf_session *session,
660 struct addr_location *al, symbol_filter_t filter) 660 struct addr_location *al, struct sample_data *data,
661 symbol_filter_t filter)
661{ 662{
662 u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 663 u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
663 struct thread *thread = perf_session__findnew(session, self->ip.pid); 664 struct thread *thread;
665
666 event__parse_sample(self, session->sample_type, data);
667
668 dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld cpu:%d\n",
669 self->header.misc, data->pid, data->tid, data->ip,
670 data->period, data->cpu);
671
672 if (session->sample_type & PERF_SAMPLE_CALLCHAIN) {
673 unsigned int i;
674
675 dump_printf("... chain: nr:%Lu\n", data->callchain->nr);
676
677 if (!ip_callchain__valid(data->callchain, self)) {
678 pr_debug("call-chain problem with event, "
679 "skipping it.\n");
680 goto out_filtered;
681 }
664 682
683 if (dump_trace) {
684 for (i = 0; i < data->callchain->nr; i++)
685 dump_printf("..... %2d: %016Lx\n",
686 i, data->callchain->ips[i]);
687 }
688 }
689 thread = perf_session__findnew(session, self->ip.pid);
665 if (thread == NULL) 690 if (thread == NULL)
666 return -1; 691 return -1;
667 692
@@ -687,6 +712,7 @@ int event__preprocess_sample(const event_t *self, struct perf_session *session,
687 al->map ? al->map->dso->long_name : 712 al->map ? al->map->dso->long_name :
688 al->level == 'H' ? "[hypervisor]" : "<not found>"); 713 al->level == 'H' ? "[hypervisor]" : "<not found>");
689 al->sym = NULL; 714 al->sym = NULL;
715 al->cpu = data->cpu;
690 716
691 if (al->map) { 717 if (al->map) {
692 if (symbol_conf.dso_list && 718 if (symbol_conf.dso_list &&
@@ -726,9 +752,9 @@ out_filtered:
726 return 0; 752 return 0;
727} 753}
728 754
729int event__parse_sample(event_t *event, u64 type, struct sample_data *data) 755int event__parse_sample(const event_t *event, u64 type, struct sample_data *data)
730{ 756{
731 u64 *array = event->sample.array; 757 const u64 *array = event->sample.array;
732 758
733 if (type & PERF_SAMPLE_IP) { 759 if (type & PERF_SAMPLE_IP) {
734 data->ip = event->ip.ip; 760 data->ip = event->ip.ip;
@@ -767,7 +793,8 @@ int event__parse_sample(event_t *event, u64 type, struct sample_data *data)
767 u32 *p = (u32 *)array; 793 u32 *p = (u32 *)array;
768 data->cpu = *p; 794 data->cpu = *p;
769 array++; 795 array++;
770 } 796 } else
797 data->cpu = -1;
771 798
772 if (type & PERF_SAMPLE_PERIOD) { 799 if (type & PERF_SAMPLE_PERIOD) {
773 data->period = *array; 800 data->period = *array;