aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/session.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index a765b274390e..69760cd4cc44 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -748,24 +748,10 @@ static int perf_session__preprocess_sample(struct perf_session *session,
748 return 0; 748 return 0;
749} 749}
750 750
751static int perf_session__process_event(struct perf_session *session, 751static int perf_session__process_user_event(struct perf_session *session, event_t *event,
752 event_t *event, 752 struct perf_event_ops *ops, u64 file_offset)
753 struct perf_event_ops *ops,
754 u64 file_offset)
755{ 753{
756 struct sample_data sample; 754 dump_event(session, event, file_offset, NULL);
757 int ret;
758
759 if (session->header.needs_swap && event__swap_ops[event->header.type])
760 event__swap_ops[event->header.type](event);
761
762 if (event->header.type >= PERF_RECORD_HEADER_MAX)
763 return -EINVAL;
764
765 hists__inc_nr_events(&session->hists, event->header.type);
766
767 if (event->header.type >= PERF_RECORD_USER_TYPE_START)
768 dump_event(session, event, file_offset, NULL);
769 755
770 /* These events are processed right away */ 756 /* These events are processed right away */
771 switch (event->header.type) { 757 switch (event->header.type) {
@@ -782,8 +768,28 @@ static int perf_session__process_event(struct perf_session *session,
782 case PERF_RECORD_FINISHED_ROUND: 768 case PERF_RECORD_FINISHED_ROUND:
783 return ops->finished_round(event, session, ops); 769 return ops->finished_round(event, session, ops);
784 default: 770 default:
785 break; 771 return -EINVAL;
786 } 772 }
773}
774
775static int perf_session__process_event(struct perf_session *session,
776 event_t *event,
777 struct perf_event_ops *ops,
778 u64 file_offset)
779{
780 struct sample_data sample;
781 int ret;
782
783 if (session->header.needs_swap && event__swap_ops[event->header.type])
784 event__swap_ops[event->header.type](event);
785
786 if (event->header.type >= PERF_RECORD_HEADER_MAX)
787 return -EINVAL;
788
789 hists__inc_nr_events(&session->hists, event->header.type);
790
791 if (event->header.type >= PERF_RECORD_USER_TYPE_START)
792 return perf_session__process_user_event(session, event, ops, file_offset);
787 793
788 /* 794 /*
789 * For all kernel events we get the sample data 795 * For all kernel events we get the sample data