aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-12-07 07:49:01 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-12-09 09:15:43 -0500
commitba74f0640d963ccc914ac533cb0ba133ee07bcf2 (patch)
tree1bb018963e13c5cc84c35c42e9cc18543ea43854 /tools
parent3dfc2c0aee789843d18f6e4675658e6879465a56 (diff)
perf session: Split out user event processing
Simplify further. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ian Munsie <imunsie@au1.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <20101207124551.110956235@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
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