aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-11-30 12:49:44 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-11-30 16:58:10 -0500
commitd6513281c5f728d138ba895d600b9788e51508b1 (patch)
treeed0b0b681cf2ba32c29b2ee745764b4778be52d5 /tools/perf/util/session.c
parent85b99952ccd3d84707661d8ae103c710daca1c8a (diff)
perf session: Simplify termination checks
No need to check twice. Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20101130163820.152886642@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 3c140daba63a..9c806ab565ea 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -738,7 +738,7 @@ int __perf_session__process_events(struct perf_session *session,
738 u64 data_offset, u64 data_size, 738 u64 data_offset, u64 data_size,
739 u64 file_size, struct perf_event_ops *ops) 739 u64 file_size, struct perf_event_ops *ops)
740{ 740{
741 u64 head, page_offset, file_offset; 741 u64 head, page_offset, file_offset, file_pos;
742 int err, mmap_prot, mmap_flags; 742 int err, mmap_prot, mmap_flags;
743 struct ui_progress *progress; 743 struct ui_progress *progress;
744 size_t page_size; 744 size_t page_size;
@@ -758,6 +758,9 @@ int __perf_session__process_events(struct perf_session *session,
758 file_offset = page_offset; 758 file_offset = page_offset;
759 head = data_offset - page_offset; 759 head = data_offset - page_offset;
760 760
761 if (data_offset + data_size < file_size)
762 file_size = data_offset + data_size;
763
761 mmap_prot = PROT_READ; 764 mmap_prot = PROT_READ;
762 mmap_flags = MAP_SHARED; 765 mmap_flags = MAP_SHARED;
763 766
@@ -773,6 +776,7 @@ remap:
773 err = -errno; 776 err = -errno;
774 goto out_err; 777 goto out_err;
775 } 778 }
779 file_pos = file_offset + head;
776 ui_progress__update(progress, file_offset); 780 ui_progress__update(progress, file_offset);
777 781
778more: 782more:
@@ -799,10 +803,10 @@ more:
799 size = event->header.size; 803 size = event->header.size;
800 804
801 dump_printf("\n%#Lx [%#x]: event: %d\n", 805 dump_printf("\n%#Lx [%#x]: event: %d\n",
802 file_offset + head, event->header.size, event->header.type); 806 file_pos, event->header.size, event->header.type);
803 807
804 if (size == 0 || perf_session__process_event(session, event, ops, 808 if (size == 0 ||
805 file_offset + head) < 0) { 809 perf_session__process_event(session, event, ops, file_pos) < 0) {
806 dump_printf("%#Lx [%#x]: skipping unknown header type: %d\n", 810 dump_printf("%#Lx [%#x]: skipping unknown header type: %d\n",
807 file_offset + head, event->header.size, 811 file_offset + head, event->header.size,
808 event->header.type); 812 event->header.type);
@@ -817,13 +821,11 @@ more:
817 } 821 }
818 822
819 head += size; 823 head += size;
824 file_pos += size;
820 825
821 if (file_offset + head >= data_offset + data_size) 826 if (file_pos < file_size)
822 goto done;
823
824 if (file_offset + head < file_size)
825 goto more; 827 goto more;
826done: 828
827 err = 0; 829 err = 0;
828 /* do the final flush for ordered samples */ 830 /* do the final flush for ordered samples */
829 session->ordered_samples.next_flush = ULLONG_MAX; 831 session->ordered_samples.next_flush = ULLONG_MAX;