diff options
author | David Ahern <dsahern@gmail.com> | 2012-08-26 14:24:41 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-05 16:17:30 -0400 |
commit | d25380cd3be38baff4ab31935b9d19b7f58ba7ac (patch) | |
tree | ee24361e1aa8f92df785e760dff71801ed7f3432 /tools | |
parent | ff1a70e75fd005821ab5f2211312a8aa13bbf959 (diff) |
perf session: flush_sample_queue needs to handle errors from handlers
Allows errors to propogate through event processing code and back to
commands.
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1346005487-62961-2-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/session.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index f7bb7ae328da..945375897c2a 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -692,7 +692,7 @@ static int perf_session_deliver_event(struct perf_session *session, | |||
692 | struct perf_tool *tool, | 692 | struct perf_tool *tool, |
693 | u64 file_offset); | 693 | u64 file_offset); |
694 | 694 | ||
695 | static void flush_sample_queue(struct perf_session *s, | 695 | static int flush_sample_queue(struct perf_session *s, |
696 | struct perf_tool *tool) | 696 | struct perf_tool *tool) |
697 | { | 697 | { |
698 | struct ordered_samples *os = &s->ordered_samples; | 698 | struct ordered_samples *os = &s->ordered_samples; |
@@ -705,7 +705,7 @@ static void flush_sample_queue(struct perf_session *s, | |||
705 | int ret; | 705 | int ret; |
706 | 706 | ||
707 | if (!tool->ordered_samples || !limit) | 707 | if (!tool->ordered_samples || !limit) |
708 | return; | 708 | return 0; |
709 | 709 | ||
710 | list_for_each_entry_safe(iter, tmp, head, list) { | 710 | list_for_each_entry_safe(iter, tmp, head, list) { |
711 | if (iter->timestamp > limit) | 711 | if (iter->timestamp > limit) |
@@ -715,9 +715,12 @@ static void flush_sample_queue(struct perf_session *s, | |||
715 | s->header.needs_swap); | 715 | s->header.needs_swap); |
716 | if (ret) | 716 | if (ret) |
717 | pr_err("Can't parse sample, err = %d\n", ret); | 717 | pr_err("Can't parse sample, err = %d\n", ret); |
718 | else | 718 | else { |
719 | perf_session_deliver_event(s, iter->event, &sample, tool, | 719 | ret = perf_session_deliver_event(s, iter->event, &sample, tool, |
720 | iter->file_offset); | 720 | iter->file_offset); |
721 | if (ret) | ||
722 | return ret; | ||
723 | } | ||
721 | 724 | ||
722 | os->last_flush = iter->timestamp; | 725 | os->last_flush = iter->timestamp; |
723 | list_del(&iter->list); | 726 | list_del(&iter->list); |
@@ -737,6 +740,8 @@ static void flush_sample_queue(struct perf_session *s, | |||
737 | } | 740 | } |
738 | 741 | ||
739 | os->nr_samples = 0; | 742 | os->nr_samples = 0; |
743 | |||
744 | return 0; | ||
740 | } | 745 | } |
741 | 746 | ||
742 | /* | 747 | /* |
@@ -782,10 +787,11 @@ static int process_finished_round(struct perf_tool *tool, | |||
782 | union perf_event *event __used, | 787 | union perf_event *event __used, |
783 | struct perf_session *session) | 788 | struct perf_session *session) |
784 | { | 789 | { |
785 | flush_sample_queue(session, tool); | 790 | int ret = flush_sample_queue(session, tool); |
786 | session->ordered_samples.next_flush = session->ordered_samples.max_timestamp; | 791 | if (!ret) |
792 | session->ordered_samples.next_flush = session->ordered_samples.max_timestamp; | ||
787 | 793 | ||
788 | return 0; | 794 | return ret; |
789 | } | 795 | } |
790 | 796 | ||
791 | /* The queue is ordered by time */ | 797 | /* The queue is ordered by time */ |
@@ -1443,7 +1449,7 @@ more: | |||
1443 | err = 0; | 1449 | err = 0; |
1444 | /* do the final flush for ordered samples */ | 1450 | /* do the final flush for ordered samples */ |
1445 | session->ordered_samples.next_flush = ULLONG_MAX; | 1451 | session->ordered_samples.next_flush = ULLONG_MAX; |
1446 | flush_sample_queue(session, tool); | 1452 | err = flush_sample_queue(session, tool); |
1447 | out_err: | 1453 | out_err: |
1448 | perf_session__warn_about_errors(session, tool); | 1454 | perf_session__warn_about_errors(session, tool); |
1449 | perf_session_free_sample_buffers(session); | 1455 | perf_session_free_sample_buffers(session); |