diff options
author | Tom Zanussi <tzanussi@gmail.com> | 2010-05-05 01:27:40 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2010-05-09 07:49:52 -0400 |
commit | 794e43b56c18b95fc9776c914a2659e7d558a352 (patch) | |
tree | 4c31bcb7ed0e7e23b5da02a4b4f6d2c218236463 /tools | |
parent | 2c193c736803ceb547daec725e5c5d992d039f20 (diff) |
perf/live-mode: Handle payload-less events
Some events, such as the PERF_RECORD_FINISHED_ROUND event consist of
only an event header and no data. In this case, a 0-length payload
will be read, and the 0 return value will be wrongly interpreted as an
'unexpected end of event stream'.
This patch allows for proper handling of data-less events by skipping
0-length reads.
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
LKML-Reference: <1273038527.6383.51.camel@tropicana>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/session.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 9401909fa283..00ab298bbb4b 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -696,15 +696,18 @@ more: | |||
696 | p = &event; | 696 | p = &event; |
697 | p += sizeof(struct perf_event_header); | 697 | p += sizeof(struct perf_event_header); |
698 | 698 | ||
699 | err = do_read(self->fd, p, size - sizeof(struct perf_event_header)); | 699 | if (size - sizeof(struct perf_event_header)) { |
700 | if (err <= 0) { | 700 | err = do_read(self->fd, p, |
701 | if (err == 0) { | 701 | size - sizeof(struct perf_event_header)); |
702 | pr_err("unexpected end of event stream\n"); | 702 | if (err <= 0) { |
703 | goto done; | 703 | if (err == 0) { |
704 | } | 704 | pr_err("unexpected end of event stream\n"); |
705 | goto done; | ||
706 | } | ||
705 | 707 | ||
706 | pr_err("failed to read event data\n"); | 708 | pr_err("failed to read event data\n"); |
707 | goto out_err; | 709 | goto out_err; |
710 | } | ||
708 | } | 711 | } |
709 | 712 | ||
710 | if (size == 0 || | 713 | if (size == 0 || |